Remove container name not empty check#12269
Conversation
|
LGTM |
|
The problem with this is that now we say: |
|
At least for delete, I prefer the current msg: |
|
@duglin So does deleteContainers not fall under the same scenario as stated in the issue "Check is not needed because the http handler didn't match that route with an empty string" ? |
|
Why shouldn't it? There's another check in GetFullContainerName in ContainerRm that says Container name cannot be emtpy. @duglin when is printing Prefix can't be empty? |
|
Actually, I would almost prefer if we checked for these on the CLI - and printed a nice error message from there. Then on the daemon side I'd expect both to return 404's since I think they map to: |
|
I like 404 from a rest view.. |
|
@runcom with this PR I get this: which isn't very friendly as the old way. |
|
@duglin wasn't working before also then https://github.com/docker/docker/pull/12197/files |
|
because there was no check before, and that just maintained the old behaviour |
I get this error even on 1.6 rc5 |
|
In my master (just refreshed) I get: |
|
Regardless, I think the "Container name cannot be empty" is the right one - so, let's make that come out.... somehow (and on purpose) :-) |
|
@duglin So change back deleteContainers, but getContainersChanges is fine as is? |
|
you get that on master AND on 1.5.0+... however yes Container name cannot be empty is more meaningful |
|
@kostickm let's add checks to the CLI code to stop "" even before it tries to hit the daemon - for both. I think the daemon side changes for "changes"/diff are ok. For "delete" though, we have an interesting situation where: |
|
I'll work on making those changes. |
29540ca to
a70b198
Compare
|
@duglin For delete, the place where it returns the 404 or the "Prefix can't be empty" is found in pkg/truncindex/truncindex.go. I didn't want to change it at that level in case it is needed in other cases. Though from the CLI with the "" check in place we won't run into this error. I tested it without the CLI check though to make sure it returns the 404 in all cases now. Let me know what you think :) |
api/server/server.go
Outdated
There was a problem hiding this comment.
since you don't need the errStr var anywhere else, you can put the strings.ToLower.. line as the first parameter to strings.Contains()
|
@estesp Let me change that! |
Signed-off-by: Megan Kostick <[email protected]>
a70b198 to
98f8577
Compare
|
LGTM |
|
Actually, I take that back - in the rm case it is hitting the new code so that's good :-) (I had a typo in my test) |
|
LGTM |
Remove container name not empty check
Removed the unneeded not empty container name check from getContainersChanges and deleteContainers. Fixes #12251
Signed-off-by: Megan Kostick [email protected]