MCPcopy
hub / github.com/crowdsecurity/crowdsec / Prepare

Method Prepare

pkg/hubops/enable.go:25–48  ·  view source on GitHub ↗
(plan *ActionPlan)

Source from the content-addressed store, hash-verified

23}
24
25func (c *EnableCommand) Prepare(plan *ActionPlan) (bool, error) {
26 var dependencies cwhub.Dependencies
27
28 i := c.Item
29
30 if c.FromLatest {
31 // we are upgrading
32 dependencies = i.LatestDependencies()
33 } else {
34 dependencies = i.CurrentDependencies()
35 }
36
37 for sub := range dependencies.SubItems(plan.hub) {
38 if err := plan.AddCommand(NewEnableCommand(sub, c.Force)); err != nil {
39 return false, err
40 }
41 }
42
43 if i.State.IsInstalled() {
44 return false, nil
45 }
46
47 return true, nil
48}
49
50// CreateInstallLink creates a symlink between the actual config file at hub.HubDir and hub.ConfigDir.
51func CreateInstallLink(i *cwhub.Item) error {

Callers

nothing calls this directly

Calls 6

SubItemsMethod · 0.95
NewEnableCommandFunction · 0.85
LatestDependenciesMethod · 0.80
CurrentDependenciesMethod · 0.80
AddCommandMethod · 0.80
IsInstalledMethod · 0.80

Tested by

no test coverage detected