-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix always listing nodes in docker stack ps command #1093
Conversation
…. A user without node listing rights could not use this command as it always fails. Signed-off-by: Silvin Lubecki <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit, otherwise LGTM
@@ -20,8 +20,7 @@ func RunRemove(dockerCli *KubeCli, opts options.Remove) error { | |||
fmt.Fprintf(dockerCli.Out(), "Removing stack: %s\n", stack) | |||
err := stacks.Delete(stack) | |||
if err != nil { | |||
fmt.Fprintf(dockerCli.Out(), "Failed to remove stack %s: %s\n", stack, err) | |||
return err | |||
return fmt.Errorf("Failed to remove stack %s: %s", stack, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; probably better to use;
return errors.Wrapf(err, "Failed to remove stack %s", stack)
Can also put the err
inside the if
;
if err := stacks.Delete(stack); err != nil {
return errors.Wrapf(err, "Failed to remove stack %s", stack)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐯
Signed-off-by: Silvin Lubecki <[email protected]>
8c64150
to
a252cb1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
fmt.Fprintf(dockerCli.Out(), "Failed to remove stack %s: %s\n", stack, err) | ||
return err | ||
if err := stacks.Delete(stack); err != nil { | ||
return errors.Wrapf(err, "Failed to remove stack %s", stack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: shouldn't error messages be all lowercase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was looking at that, but this is printed on the CLI, and other messages (non-error) were also capitalised ("Removing stack ..." and so on)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough even if the other messages are not errors but printed directly to dockerCli.Out()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a look through all messages to check for consistency though 👍
- What I did
docker stack ps
command on Kubernetes which always failed with a user without node listing privilege.docker stack rm
command.- How to verify it
docker stack ps
on this namespace -> it should not fail and list all the containers- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)