-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
output some details when stack name does not exist #24051
output some details when stack name does not exist #24051
Conversation
ping @aanand |
Nice, thanks. Error message wording is a little inconsistent when a name isn't found, but the most common phrase seems to be "No such [thing]: [name]". Would you mind updating the message accordingly, so it reads |
Hmm. Reading over the change to Perhaps it should only error out if there are no resources of any kind found which match the stack name. @dnephin? |
I don't think either of these changes are correct. The current behaviour is correct. Think of For remove, I think we should consider the operation idempotent. So running remove again and having it remove nothing is fine. This is a bit different from other Ssaying remove object with id x, and that object not existing would be an error. |
2613e81
to
8099b55
Compare
moving back to design review pending the discussion |
I'm fine with neither condition being an error, but I think we can still try to help with typos, at least in the |
@dnephin |
6627058
to
4bea57c
Compare
@aanand |
This sounds good to me |
@dnephin |
4bea57c
to
b78fde5
Compare
@dnephin @aanand @thaJeztah |
if len(services) == 0 { | ||
fmt.Fprintf(dockerCli.Out(), "Nothing found in stack: %s\n", namespace) | ||
return nil | ||
} |
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.
In this case I don't think we should add another API call.
We could add the warning if len(tasks) == 0
, or we could just not warn.
49c63f6
to
17534bb
Compare
LGTM, thanks! |
Also bonus points if we can add a test ;-) |
LGTM, but agree that a test would be nice to prevent future regressions |
@@ -63,6 +63,11 @@ func runRemove(dockerCli *client.DockerCli, opts removeOptions) error { | |||
} | |||
} | |||
|
|||
if len(services) == 0 && len(networks) == 0 { |
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.
@allencloud i might be missing something but what does this mean wrt a stack? As in, what's a stack with no services but only networks? just trying to make sense of this.
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.
This is part of the stack rm
command which also removes the networks, so if a network existed this command wouldn't be a no-op, hence no warning. I believe that's the idea.
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.
Yeah. If a stack was brought up with both networks and services, then the services were all manually deleted, you'd expect stack rm
to still remove the networks.
LGTM 🐯 |
I agree with adding test. I will ping you guys once added. Thank all of you. |
f7083fa
to
e524014
Compare
LGTM |
Looks like tests are failing: https://jenkins.dockerproject.org/job/Docker-PRs/29613/console
and on experimental:
|
0255390
to
667024a
Compare
CI still failing. |
667024a
to
b4e7b06
Compare
Signed-off-by: allencloud <allen.sun@daocloud.io>
b4e7b06
to
416613f
Compare
PR updated and test updated. PTAL. |
Still LGTM and it's all green, merging 😉 |
fix #23727
return err when stack name does not exist
Since there is no stack concept in the docker engine side, so check this in the client side.
As a result, output shows like this:
This PR did:
docker stack service xxx
anddocker stack remove xxx
Signed-off-by: allencloud allen.sun@daocloud.io