Convert inspect command to Cobra#23902
Conversation
1ca1b1f to
c85b019
Compare
c85b019 to
50e351a
Compare
|
hmm, it looks like there was a bug in the old command. I treated any error in task inspect as "not found". I tried to correct that, but now a bunch of tests are failing because they are inspecting without swarm mode being enabled. I could restore the old behaviour, but maybe I should just special case that error as well, and treat it as a not found. |
5036738 to
e4eb785
Compare
|
This conflicts heavily with #23614 |
There was a problem hiding this comment.
doesn't exist, maybe some typo
ad428fc to
b3e3099
Compare
|
rebased |
|
Thanks! Been testing this a bit, and wonder if we should tweak the response a bit, for example, running on a non-swarm-manager: I think we should change the response to Possibly something that was already there, but I just noticed; when using Since this is an error, the |
|
Other than the nits above, LGTM |
That is already the order items are queried. I've updated the error message to match the order. We can't really change the order because that would lead to different behaviour from previous versions when names or ids overlap.
The empty array is shown for all other errors, so I think it should be for the "no swarm" error as well. |
Signed-off-by: Daniel Nephin <[email protected]>
bb40331 to
0e804a0
Compare
Oh, that's what I meant; sorry for the confusion; meant to say, the message doesn't match the actual order. |
|
Do you think we should change the output in non-swarm (manager) mode, and remove "task" from the error? ( |
Not really, I don't think we gain anything from the extra code to do that. |
Signed-off-by: Daniel Nephin <[email protected]>
0e804a0 to
fab2a3d
Compare
| } | ||
|
|
||
| // make sure the container is not running | ||
| runningOut, err := s.d.Cmd("inspect", "--format='{{.State.Running}}'", "top") |
There was a problem hiding this comment.
These quote changes are just a cleanup?
There was a problem hiding this comment.
Yup, we made this change to a bunch of tests as we ported things to spf13/pflags. The old pkg/mflag had special code that was used exclusively by tests to strip these single quotes. Normally on a shell they would be removed by bash, but since this command isn't passed to bash they don't have any purpose.
|
LGTM |
1 similar comment
|
LGTM |
#23211