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>
Upstream-commit: 857e60c2f943a09e3ec0ac0f236821b797935900
Component: engine
This commit is contained in:
Evan Hazlett
2016-10-26 13:30:53 -07:00
parent 9dbbc071d5
commit dde21cf7dc
12 changed files with 96 additions and 40 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
}