Change return value for ValidateMountMode

1. rename it from ValidateMountMode to ValidMountMode
Because it's a function simply check mount mode is valid or not.
2. remove the rw check return value
It's not supposed to be combined into this function, and we already
have a function for that check.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2015-08-24 17:28:19 +08:00 committed by Vincent Demeester
parent 869e08a12b
commit 6a31056ff6
1 changed files with 2 additions and 2 deletions

View File

@ -202,7 +202,7 @@ func validatePath(val string, validateMountMode bool) (string, error) {
containerPath = splited[0]
val = path.Clean(containerPath)
case 2:
if isValid, _ := volume.ValidateMountMode(splited[1]); validateMountMode && isValid {
if isValid := volume.ValidMountMode(splited[1]); validateMountMode && isValid {
containerPath = splited[0]
mode = splited[1]
val = fmt.Sprintf("%s:%s", path.Clean(containerPath), mode)
@ -213,7 +213,7 @@ func validatePath(val string, validateMountMode bool) (string, error) {
case 3:
containerPath = splited[1]
mode = splited[2]
if isValid, _ := volume.ValidateMountMode(splited[2]); validateMountMode && !isValid {
if isValid := volume.ValidMountMode(splited[2]); validateMountMode && !isValid {
return val, fmt.Errorf("bad mount mode specified : %s", mode)
}
val = fmt.Sprintf("%s:%s:%s", splited[0], containerPath, mode)