crowdsec icon indicating copy to clipboard operation
crowdsec copied to clipboard

Improvement/Deletion of multiple bouncers at the same time

Open davezaxh opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. I recently came across a situation where I had delete multiple bouncers installed on my instances.

Describe the solution you'd like I accidentaly installed multiple unwanted bouncers, on realizing it I tried to uninstall them, but realized there were 25 of them. I had to individually remove all of them to keep the one which I wanted.

Describe alternatives you've considered (Optional) It would really if we could give an argument to remove a particular number or all of the bouncers in a single line, instead of multiple monotonous lines.

Example of what you imagine This is command being mentioned in the above situation sudo cscli bouncers delete BOUNCER-NAME It could be written as: sudo cscli bouncers delete -n 4 or sudo cscli bouncers delete --all.

Additional context feature

davezaxh avatar Jun 02 '22 15:06 davezaxh

Hello,

Thanks for the issue, this is definitely something we want to add.

In the meantime, you can delete all bouncer with this command:

for x in $(cscli bouncers list -o json | jq -r '.[] | .name'); do cscli bouncers delete "$x"; done

blotus avatar Jun 03 '22 14:06 blotus

That was of great help! Thank you

davezaxh avatar Jun 04 '22 17:06 davezaxh

From the help text it's not clear that we can already delete multiple bouncers at once, by providing several positional arguments:

$ ./tests/local/bin/cscli bouncers delete --help
delete bouncer

Usage:
  cscli bouncers delete MyBouncerName [flags]

The help text (for all the commands) could be improved to conform with unix practices, like

$ rm --help
Usage: rm [OPTION]... [FILE]...
Remove (unlink) the FILE(s).

I'm keeping this open until I have done a review.

mmetc avatar Oct 05 '22 08:10 mmetc

We added #2379 and updated help output of delete command that you can pass multiple names.

Closing as it has been merged and will be released 1.5.3

LaurenceJJones avatar Aug 03 '23 10:08 LaurenceJJones