diff --git a/sarracenia/config.py b/sarracenia/config.py index b568789e0..94bce8443 100755 --- a/sarracenia/config.py +++ b/sarracenia/config.py @@ -2339,8 +2339,8 @@ def parse_args(self, isPost=False): nargs='?', help=' specifical configuration to select ') parser.add_argument('--dangerWillRobinson', - action='store_true', - default=False, + type=int, + default=0, help='Confirm you want to do something dangerous') parser.add_argument('--debug', action='store_true', diff --git a/sarracenia/sr.py b/sarracenia/sr.py index d5d029b48..9156d583a 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -1577,11 +1577,11 @@ def foreground(self): def cleanup(self): - if len(self.filtered_configurations - ) > 1 and not self.options.dangerWillRobinson: - logging.error( - "specify --dangerWillRobinson to cleanup > 1 config at a time") - return + if len(self.filtered_configurations) > 1 : + if len(self.filtered_configurations) != self.options.dangerWillRobinson: + logging.error( + "specify --dangerWillRobinson= of configs to cleanup when cleaning more than one") + return queues_to_delete = [] for f in self.filtered_configurations: @@ -1828,11 +1828,13 @@ def remove(self): logging.error("No configuration matched") return - if len(self.filtered_configurations - ) > 1 and not self.options.dangerWillRobinson: - logging.error( - "specify --dangerWillRobinson to remove > 1 config at a time") - return + logging.error( f" configs matched: {len(self.filtered_configurations)} ") + + if len(self.filtered_configurations) > 1 : + if len(self.filtered_configurations) != self.options.dangerWillRobinson: + logging.error( + "specify --dangerWillRobinson= of configs to remove when > 1 involved.") + return for f in self.filtered_configurations: if self.please_stop: @@ -2128,7 +2130,7 @@ def stop(self): print('All stopped after try %d' % attempts) if len(fg_instances) > 0: print(f"Foreground instances {fg_instances} are running and were not stopped.") - print("Use --dangerWillRobinson to force stop foreground instances with sr3 stop.") + print("Use --dangerWillRobinson=1 to force stop foreground instances with sr3 stop.") return 0 attempts += 1 @@ -2187,7 +2189,7 @@ def stop(self): print('All stopped after KILL') if len(fg_instances) > 0: print(f"Foreground instances {fg_instances} are running and were not stopped.") - print("Use --dangerWillRobinson to force stop foreground instances with sr3 stop.") + print("Use --dangerWillRobinson=1 to force stop foreground instances with sr3 stop.") return 0 else: print('not responding to SIGKILL:')