Skip to content

Commit

Permalink
Merge branch 'master' into allowlist-appsec-test-config
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Feb 26, 2025
2 parents 9aa1fe9 + c161eb2 commit c5b4bcd
Show file tree
Hide file tree
Showing 15 changed files with 189 additions and 131 deletions.
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/clihub/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func SelectItems(hub *cwhub.Hub, itemType string, args []string, installedOnly b

for _, itemName := range itemNames {
item := hub.GetItem(itemType, itemName)
if installedOnly && !item.State.Installed {
if installedOnly && !item.State.IsInstalled() {
continue
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/crowdsec-cli/cliitem/cmdinspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (cli cliItem) inspect(ctx context.Context, args []string, url string, diff

// return the diff between the installed version and the latest version
func (cli cliItem) itemDiff(ctx context.Context, item *cwhub.Item, contentProvider cwhub.ContentProvider, reverse bool) (string, error) {
if !item.State.Installed {
if !item.State.IsInstalled() {
return "", fmt.Errorf("'%s' is not installed", item.FQName())
}

Expand Down Expand Up @@ -113,7 +113,7 @@ func (cli cliItem) itemDiff(ctx context.Context, item *cwhub.Item, contentProvid
}

func (cli cliItem) whyTainted(ctx context.Context, hub *cwhub.Hub, contentProvider cwhub.ContentProvider, item *cwhub.Item, reverse bool) string {
if !item.State.Installed {
if !item.State.IsInstalled() {
return fmt.Sprintf("# %s is not installed", item.FQName())
}

Expand Down Expand Up @@ -203,7 +203,7 @@ func inspectItem(hub *cwhub.Hub, item *cwhub.Item, wantMetrics bool, output stri
enc.SetIndent(2)

if err := enc.Encode(item); err != nil {
return fmt.Errorf("unable to encode item: %w", err)
return fmt.Errorf("unable to serialize item: %w", err)
}
case "json":
b, err := json.MarshalIndent(*item, "", " ")
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/cliitem/cmdremove.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func installedParentNames(item *cwhub.Item) []string {
ret := make([]string, 0)

for _, parent := range item.Ancestors() {
if parent.State.Installed {
if parent.State.IsInstalled() {
ret = append(ret, parent.Name)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/clisimulation/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (cli *cliSimulation) newEnableCmd() *cobra.Command {
log.Errorf("'%s' doesn't exist or is not a scenario", scenario)
continue
}
if !item.State.Installed {
if !item.State.IsInstalled() {
log.Warningf("'%s' isn't enabled", scenario)
}
isExcluded := slices.Contains(cli.cfg().Cscli.SimulationConfig.Exclusions, scenario)
Expand Down
Loading

0 comments on commit c5b4bcd

Please sign in to comment.