Skip to content

Commit

Permalink
Require --dangerWillRobinson for removing >1 config
Browse files Browse the repository at this point in the history
  • Loading branch information
reidsunderland committed Oct 18, 2023
1 parent c2e4a94 commit 72c62b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/sr3_action_remove
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ for argu in "$@"; do
if [[ "$argu" == "remove" ]] ; then
continue
fi
if [[ "$argu" == "--dangerWillRobinson" ]] ; then
continue
fi
files_to_remove+=("${pump_path}${argu}.conf")
done

Expand Down
5 changes: 5 additions & 0 deletions bin/sr3d
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ sr3r "sr3 $*"

# Special cases for certain actions AFTER running on nodes
if [[ "$action" == "remove" ]] ; then
# Removing more than one config at a time requires --dangerWillRobinson
if [[ "$*" != *"--dangerWillRobinson"* ]] && [[ $# -gt 2 ]]; then
echo "[ERROR] --dangerWillRobinson is required to remove more than one config."
exit 1
fi
sr3_action_remove "$@"
fi
1 change: 1 addition & 0 deletions completion/sr3_tools_completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ component_config()
# sr3d syntax is the same as sr3:
# sr3d action [component/config]
# except some actions (edit, foreground, etc.) don't make sense on a cluster
# TODO: support --dangerWillRobinson as 1st arg (before action) or 2nd arg (after action)
###
_sr3d()
{
Expand Down

0 comments on commit 72c62b8

Please sign in to comment.