Fixes bad validMountMode check

Needed to check if the mode was invalid and return error, not valid and
return error.

This didn't get picked up because the existing integration-cli tests
were all either expecting errors when a valid mode was passed in (e.g.
"ro" passed in, we expected an error because it was testing write).  So
modified a test which was testing for "rw" to actually pass in "rw"
instead of assuming the "rw"

Docker-DCO-1.1-Signed-off-by: Brian Goff <bgoff@cpuguy83-mbp.home> (github: cpuguy83)
This commit is contained in:
Brian Goff 2014-10-03 16:55:39 -04:00
parent beff5067c8
commit 007b4f6340
2 changed files with 2 additions and 2 deletions

View file

@ -235,7 +235,7 @@ func parseVolumesFromSpec(daemon *Daemon, spec string) (map[string]*Mount, error
if len(specParts) == 2 {
mode := specParts[1]
if validMountMode(mode) {
if !validMountMode(mode) {
return nil, fmt.Errorf("Invalid mode for volumes-from: %s", mode)
}

View file

@ -389,7 +389,7 @@ func TestRunVolumesFromInReadWriteMode(t *testing.T) {
t.Fatal(err)
}
cmd = exec.Command(dockerBinary, "run", "--volumes-from", "parent", "busybox", "touch", "/test/file")
cmd = exec.Command(dockerBinary, "run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file")
if _, err := runCommand(cmd); err != nil {
t.Fatal(err)
}