summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-10 07:13:32 -0800
committerGitHub <noreply@github.com>2019-01-10 07:13:32 -0800
commit69c3e329411318f51381649e77df70bbfc3e4b2e (patch)
treeb89584f0f44d5384ebdc8ebbf56d9c3a92286ee6 /cmd/podman
parentd196d9c8160234a0de3867531807cb46f39898be (diff)
parent4e234136bccc295204f772317e957f54d42a5ff9 (diff)
downloadpodman-69c3e329411318f51381649e77df70bbfc3e4b2e.tar.gz
podman-69c3e329411318f51381649e77df70bbfc3e4b2e.tar.bz2
podman-69c3e329411318f51381649e77df70bbfc3e4b2e.zip
Merge pull request #2122 from giuseppe/sign-fixes
sign: some fixes
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/sign.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/podman/sign.go b/cmd/podman/sign.go
index 8a31ddb98..e7367a311 100644
--- a/cmd/podman/sign.go
+++ b/cmd/podman/sign.go
@@ -1,10 +1,10 @@
package main
import (
- "fmt"
"io/ioutil"
"net/url"
"os"
+ "path/filepath"
"strconv"
"strings"
@@ -59,7 +59,7 @@ func signCmd(c *cli.Context) error {
signby := c.String("sign-by")
if signby == "" {
- return errors.Errorf("You must provide an identity")
+ return errors.Errorf("please provide an identity")
}
var sigStoreDir string
@@ -72,11 +72,11 @@ func signCmd(c *cli.Context) error {
mech, err := signature.NewGPGSigningMechanism()
if err != nil {
- return errors.Wrap(err, "Error initializing GPG")
+ return errors.Wrap(err, "error initializing GPG")
}
defer mech.Close()
if err := mech.SupportsSigning(); err != nil {
- return errors.Wrap(err, "Signing is not supported")
+ return errors.Wrap(err, "signing is not supported")
}
systemRegistriesDirPath := trust.RegistriesDirPath(runtime.SystemContext())
@@ -100,7 +100,7 @@ func signCmd(c *cli.Context) error {
}
dockerReference := rawSource.Reference().DockerReference()
if dockerReference == nil {
- return errors.Errorf("Cannot determine canonical Docker reference for destination %s", transports.ImageName(rawSource.Reference()))
+ return errors.Errorf("cannot determine canonical Docker reference for destination %s", transports.ImageName(rawSource.Reference()))
}
// create the signstore file
@@ -141,7 +141,7 @@ func signCmd(c *cli.Context) error {
return errors.Wrapf(err, "error creating new signature")
}
- sigStoreDir = fmt.Sprintf("%s/%s", sigStoreDir, strings.Replace(repos[0][strings.Index(repos[0], "/")+1:len(repos[0])], ":", "=", 1))
+ sigStoreDir = filepath.Join(sigStoreDir, strings.Replace(repos[0][strings.Index(repos[0], "/")+1:len(repos[0])], ":", "=", 1))
if err := os.MkdirAll(sigStoreDir, 0751); err != nil {
// The directory is allowed to exist
if !os.IsExist(err) {
@@ -154,7 +154,7 @@ func signCmd(c *cli.Context) error {
logrus.Errorf("error creating sigstore file: %v", err)
continue
}
- err = ioutil.WriteFile(sigStoreDir+"/"+sigFilename, newSig, 0644)
+ err = ioutil.WriteFile(filepath.Join(sigStoreDir, sigFilename), newSig, 0644)
if err != nil {
logrus.Errorf("error storing signature for %s", rawSource.Reference().DockerReference().String())
continue
@@ -190,7 +190,7 @@ func isValidSigStoreDir(sigStoreDir string) (string, error) {
}
_, exists := writeURIs[url.Scheme]
if !exists {
- return sigStoreDir, errors.Errorf("Writing to %s is not supported. Use a supported scheme", sigStoreDir)
+ return sigStoreDir, errors.Errorf("writing to %s is not supported. Use a supported scheme", sigStoreDir)
}
sigStoreDir = url.Path
return sigStoreDir, nil