Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
blotus committed Nov 17, 2024
1 parent 2d4791e commit d3c0ca2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions cmd/crowdsec-cli/clibouncer/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ func (cli *cliBouncers) delete(ctx context.Context, bouncers []string, ignoreMis
}
log.Warnf("bouncer '%s' is auto-created and cannot be deleted, delete parent bouncer %s instead", bouncerName, parentBouncer)
continue
} else {
//Try to find all child bouncers and delete them
for _, childBouncer := range allBouncers {
if strings.HasPrefix(childBouncer.Name, bouncerName+"@") {
if err := cli.db.DeleteBouncer(ctx, childBouncer.Name); err != nil {
return fmt.Errorf("unable to delete bouncer: %w", err)
}
log.Infof("bouncer '%s' deleted successfully", childBouncer.Name)
}
//Try to find all child bouncers and delete them
for _, childBouncer := range allBouncers {
if strings.HasPrefix(childBouncer.Name, bouncerName+"@") {
if err := cli.db.DeleteBouncer(ctx, childBouncer.Name); err != nil {
return fmt.Errorf("unable to delete bouncer: %w", err)
}
log.Infof("bouncer '%s' deleted successfully", childBouncer.Name)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/apiserver/api_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ func TestAPIKey(t *testing.T) {
assert.Equal(t, "[email protected]", bouncers[1].Name)
assert.Equal(t, bouncers[0].APIKey, bouncers[1].APIKey)
assert.Equal(t, bouncers[0].AuthType, bouncers[1].AuthType)
assert.Equal(t, bouncers[0].AutoCreated, false)
assert.Equal(t, bouncers[1].AutoCreated, true)
assert.False(t, bouncers[0].AutoCreated)
assert.True(t, bouncers[1].AutoCreated)
}

0 comments on commit d3c0ca2

Please sign in to comment.