review changes

- fix lint issues
- use errors pkg for wrapping errors
- cleanup on error when setting up secrets mount
- fix erroneous import
- remove unneeded switch for secret reference mode
- return single mount for secrets instead of slice

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2016-10-26 13:30:53 -07:00
parent 1be644fbcf
commit 3f9494f1d6
1 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package service
import (
"context"
"fmt"
"path/filepath"
"strings"
"github.com/docker/docker/api/types"
@ -31,6 +32,13 @@ func parseSecretString(secretString string) (string, string, error) {
} else {
targetName = secretName
}
// ensure target is a filename only; no paths allowed
tDir, _ := filepath.Split(targetName)
if tDir != "" {
return "", "", fmt.Errorf("target must not have a path")
}
return secretName, targetName, nil
}