Fail accumulo-service stop/kill when no service name is given - #6537
Conversation
| if [[ -z $command_name ]]; then | ||
| invalid_args "<command> cannot be empty" | ||
| fi | ||
| if [[ $command_name =~ ^(stop|kill)$ && $all_flag != 'true' && -z $ACCUMULO_CLUSTER_ARG && -z $service_name ]]; then |
There was a problem hiding this comment.
Is there a reason not to add this arg check in the logic for the stop_service and kill_service functions?
There was a problem hiding this comment.
I wonder if the absence of a more specific parameter should imply 'all'. I'm thinking about other scripts and how they behave for consistency. For example, if you run accumulo-cluster stop, then entire cluster is stopped. The user has to supply arguments for a more targeted action. Maybe we should do the same here?
There was a problem hiding this comment.
Originally this ability was added to target names of processes that had been left over from previous cluster actions.
For example: tserver_default_4 would be running but not targetable by stop/kill since the cluster.yaml had been updated to only run 2 tserver processes.
I'm hesitating about adding an easy way to stop all services without forcing the user to be intentional.
accumulo-cluster stop makes sense because cluster implies that multiple nodes/services are being targeted.
There was a problem hiding this comment.
Yea it seems safer force the user to be more explicit when the operation is destructive.
ddanielr
left a comment
There was a problem hiding this comment.
The behavior change is beneficial. I'd switch this PR to the 2.1 branch though.
There was a good bit of work done to make sure the control scripts matched between 2.1 and main.
d6a3d92 to
9901879
Compare
|
I moved things into |
Running
accumulo-service manager stopwithout--allor an instance name silently does nothing. The script:Stopping service process:with a blank name,accumulo-.pid, which doesn't exist,The manager keeps running even though the command reported success. A later start then says manager_default_1 already running. kill has the same problem, with no output at all.
This PR adds a check in
function main()before stop/kill are dispatched. When all of these are true:it exits 1 with this message, followed by the usage text:
Invalid arguments: 'stop' requires --all or a service (e.g. manager_default_1; see 'manager list')
Nothing is stopped, and the user is told what to pass instead.
Also: