Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what should sr3 --dangerWillRobinson remove do? #827

Closed
petersilva opened this issue Nov 15, 2023 · 9 comments
Closed

what should sr3 --dangerWillRobinson remove do? #827

petersilva opened this issue Nov 15, 2023 · 9 comments
Labels
Discussion_Needed developers should discuss this issue. enhancement New feature or request likely-fixed likely fix is in the repository, success not confirmed yet. Sugar nice to have features... not super important. UserStory interesting to read to consider improving

Comments

@petersilva
Copy link
Contributor

This is the sr3 version of "rm -rf /" ... with help, can be recovered, but it's painful... There are no interactive prompts in the entire application... the --dangerWillRobinson is the only thing between a user and oblivion... is this too dangerous should we do something else?

@petersilva
Copy link
Contributor Author

@junhu3 @reidsunderland

@reidsunderland
Copy link
Member

sr3 --dangerWillRobinson remove will delete all configs. It's consistent with sr3 start and sr3 stop. But also dangerous and kind of easy to use by accident (if you start typing the command, and accidentally hit enter before specifying the configs).

One option is forcing a user to explicitly specify sr3 --dangerWillRobinson remove */* if they really want to remove every config. This would make it inconsistent with other actions like stop and start, but makes it harder to accidentally delete everything. It also avoids having to add a warning or "are you sure you want to delete everything??" prompt.

@petersilva
Copy link
Contributor Author

what if --dangerWillRobinson had an argument... and the argument had to equal the number of configurations being affected.
so... if you do


sr3  --dangerWillRobinson 2  remove poll/a*

then it will only proceed if number of configurations that result from expanding poll/a* is exactly 2.

@petersilva
Copy link
Contributor Author

it would perhaps default to two... since for 1 you don't need the option...

@andreleblanc11
Copy link
Member

I like Reid's option of using sr3 --dangerWillRobinson remove */*

Should we just just outright ban the use of --dangerWillRobinson without any arguments?

@petersilva
Copy link
Contributor Author

petersilva commented Nov 15, 2023

Making --dangerWillRobinson take an argument that has to match has a lot more value... it will stop all mismatch mistakes... I

  • */* is easy to specify also, it doesn't solve the problem of someone using --dangerWillRobinson and it still being a mistake, making them provide a second value that must match the first (like MFA) to me is a lot more added security.

@petersilva
Copy link
Contributor Author

example ... someone says sr3 --dangerWillRobinson remove poll */*

they left a space between poll and the * ... with just the specification, it will go through, but if --dangerWillRobinson 5 is there, indicating it should match exactly 5 configurations, then the */* will match 20, and it will refuse.

@petersilva
Copy link
Contributor Author

petersilva commented Nov 17, 2023

have a branch doing it, here is an example:

fractal% sr3 status

status: 
Component/Config                         Processes   Connection        Lag                              Rates                                        
                                         State   Run Retry  msg data   Queued   LagMax  LagAvg  %rej     pubsub   messages     RxData     TxData 
                                         -----   --- -----  --- ----   ------   ------  ------  ----   --------       ----     ------     ------ 
cpost/pelle_dd1_f04                      stop    0/0          -          -         -     -          -        -
cpost/pelle_dd2_f05                      stop    0/0          -          -         -     -          -        -
cpost/veille_f34                         stop    0/0          -          -         -     -          -        -
cpump/xvan_f14                           stop    0/0          -          -         -     -          -        -
cpump/xvan_f15                           stop    0/0          -          -         -     -          -        -
poll/sftp_f62                            stop    0/0          -          -         -     -          -        -
poll/sftp_f63                            stop    0/0          -          -         -     -          -        -
post/shim_f63                            stop    0/0          -          -         -     -          -        -
post/t_dd1_f00                           stop    0/0          -          -         -     -          -        -
post/t_dd2_f00                           stop    0/0          -          -         -     -          -        -
post/test2_f61                           stop    0/0          -          -         -     -          -        -
report/tsarra_f20                        stop    0/0          -          -         -     -          -        -
sarra/download_f20                       stop    0/0          -          -         -     -          -        -
sender/tsource2send_f50                  stop    0/0          -          -         -     -          -        -
shovel/rabbitmqtt_f22                    stop    0/0          -          -         -     -          -        -
subscribe/amqp_f30                       stop    0/0          -          -         -     -          -        -
subscribe/cdnld_f21                      stop    0/0          -          -         -     -          -        -
subscribe/cfile_f44                      stop    0/0          -          -         -     -          -        -
subscribe/cp_f61                         stop    0/0          -          -         -     -          -        -
subscribe/ftp_f70                        stop    0/0          -          -         -     -          -        -
subscribe/mirror_f80                     stop    0/0          -          -         -     -          -        -
subscribe/q_f71                          stop    0/0          -          -         -     -          -        -
subscribe/rabbitmqtt_f31                 stop    0/0          -          -         -     -          -        -
subscribe/u_sftp_f60                     stop    0/0          -          -         -     -          -        -
watch/f40                                stop    0/0          -          -         -     -          -        -
      Total Running Configs:   0 ( Processes: 0 missing: 0 stray: 0 )
                     Memory: uss:0 Bytes rss:0 Bytes vms:0 Bytes 
                   CPU Time: User:0.00s System:0.00s 
	   Pub/Sub Received: 0 msgs/s (0 Bytes/s), Sent:  0 msgs/s (0 Bytes/s) Queued: 0 Retry: 0, Mean lag: 0.00s
	      Data Received: 0 Files/s (0 Bytes/s), Sent: 0 Files/s (0 Bytes/s) 

fractal% sr3 --dangerWillRobinson=1 remove

2023-11-16 21:13:27,823 1282249 [ERROR] root remove specify --dangerWillRobinson=<n> of configs to remove when > 1 involved.
fractal%

So since remove and/or cleanup are quite dangerous in practice, force
the client to indicate how many configurations they are expecting to affect:

fractal% sr3 status | grep stop | wc -l

25

fractal%
fractal% sr3 --dangerWillRobinson=25 remove

2023-11-16 21:17:12,281 1282543 [INFO] root remove removing cpost/veille_f34
2023-11-16 21:17:12,281 1282543 [INFO] root remove removing cpost/pelle_dd2_f05
2023-11-16 21:17:12,281 1282543 [INFO] root remove removing cpost/pelle_dd1_f04
2023-11-16 21:17:12,281 1282543 [INFO] root remove removing cpump/xvan_f14
2023-11-16 21:17:12,281 1282543 [INFO] root remove removing cpump/xvan_f15
2023-11-16 21:17:12,281 1282543 [INFO] root remove removing poll/sftp_f63
2023-11-16 21:17:12,281 1282543 [INFO] root remove removing poll/sftp_f62
2023-11-16 21:17:12,281 1282543 [INFO] root remove removing post/t_dd1_f00
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing post/test2_f61
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing post/t_dd2_f00
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing post/shim_f63
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing report/tsarra_f20
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing sarra/download_f20
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing sender/tsource2send_f50
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing shovel/rabbitmqtt_f22
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing subscribe/rabbitmqtt_f31
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing subscribe/cfile_f44
2023-11-16 21:17:12,282 1282543 [INFO] root remove removing subscribe/u_sftp_f60
2023-11-16 21:17:12,283 1282543 [INFO] root remove removing subscribe/mirror_f80
2023-11-16 21:17:12,283 1282543 [INFO] root remove removing subscribe/ftp_f70
2023-11-16 21:17:12,283 1282543 [INFO] root remove removing subscribe/cp_f61
2023-11-16 21:17:12,283 1282543 [INFO] root remove removing subscribe/q_f71
2023-11-16 21:17:12,283 1282543 [INFO] root remove removing subscribe/amqp_f30
2023-11-16 21:17:12,283 1282543 [INFO] root remove removing subscribe/cdnld_f21
2023-11-16 21:17:12,283 1282543 [INFO] root remove removing watch/f40

fractal% sr3 status

status: 
Component/Config                         Processes   Connection        Lag                              Rates                                        
                                         State   Run Retry  msg data   Queued   LagMax  LagAvg  %rej     pubsub   messages     RxData     TxData 
                                         -----   --- -----  --- ----   ------   ------  ------  ----   --------       ----     ------     ------ 
      Total Running Configs:   0 ( Processes: 0 missing: 0 stray: 0 )
                     Memory: uss:0 Bytes rss:0 Bytes vms:0 Bytes 
                   CPU Time: User:0.00s System:0.00s 
	   Pub/Sub Received: 0 msgs/s (0 Bytes/s), Sent:  0 msgs/s (0 Bytes/s) Queued: 0 Retry: 0, Mean lag: 0.00s
	      Data Received: 0 Files/s (0 Bytes/s), Sent: 0 Files/s (0 Bytes/s) 
fractal% 

It is a lot more difficult to do something dangerous by mistake...

@petersilva petersilva added enhancement New feature or request UserStory interesting to read to consider improving Sugar nice to have features... not super important. Discussion_Needed developers should discuss this issue. labels Nov 17, 2023
@petersilva petersilva added the likely-fixed likely fix is in the repository, success not confirmed yet. label Nov 20, 2023
@petersilva
Copy link
Contributor Author

folks agreed with it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion_Needed developers should discuss this issue. enhancement New feature or request likely-fixed likely fix is in the repository, success not confirmed yet. Sugar nice to have features... not super important. UserStory interesting to read to consider improving
Projects
None yet
Development

No branches or pull requests

3 participants