summaryrefslogtreecommitdiff
path: root/pkg/secrets
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-06-02 06:02:34 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-04 15:12:12 +0000
commit3416e9f19466c76a42abfff7e06422a929e3b79b (patch)
tree9d1df5ab351f3c208acce31fd38e8e8d6cb42716 /pkg/secrets
parent2ec1a645fabe2032b05fb8ac4f70ca7b3497c9c4 (diff)
downloadpodman-3416e9f19466c76a42abfff7e06422a929e3b79b.tar.gz
podman-3416e9f19466c76a42abfff7e06422a929e3b79b.tar.bz2
podman-3416e9f19466c76a42abfff7e06422a929e3b79b.zip
Want to change the log level on buildah by default to warnf
Change the level of missing /etc/containers/mount.conf to a debug, since this is expected on most machines. Also raised the level of some warnings to errors, so they will be better seen, even if we are skipping. Fixed the wording of one error, since stating is not the correct word. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #882 Approved by: mheon
Diffstat (limited to 'pkg/secrets')
-rw-r--r--pkg/secrets/secrets.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/pkg/secrets/secrets.go b/pkg/secrets/secrets.go
index 12609c7e3..ba0f3b925 100644
--- a/pkg/secrets/secrets.go
+++ b/pkg/secrets/secrets.go
@@ -101,13 +101,14 @@ func getHostSecretData(hostDir string) ([]secretData, error) {
func getMounts(filePath string) []string {
file, err := os.Open(filePath)
if err != nil {
- logrus.Warnf("file %q not found, skipping...", filePath)
+ // This is expected on most systems
+ logrus.Debugf("file %q not found, skipping...", filePath)
return nil
}
defer file.Close()
scanner := bufio.NewScanner(file)
if err = scanner.Err(); err != nil {
- logrus.Warnf("error reading file %q, skipping...", filePath)
+ logrus.Errorf("error reading file %q, %v skipping...", filePath, err)
return nil
}
var mounts []string
@@ -157,12 +158,12 @@ func SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPre
_, err := os.Stat("/etc/system-fips")
if err == nil {
if err := addFIPSModeSecret(&secretMounts, containerWorkingDir); err != nil {
- logrus.Warnf("error adding FIPS mode secret to container: %v", err)
+ logrus.Errorf("error adding FIPS mode secret to container: %v", err)
}
} else if os.IsNotExist(err) {
logrus.Debug("/etc/system-fips does not exist on host, not mounting FIPS mode secret")
} else {
- logrus.Errorf("error stating /etc/system-fips for FIPS mode secret: %v", err)
+ logrus.Errorf("stat /etc/system-fips failed for FIPS mode secret: %v", err)
}
return secretMounts
}
@@ -184,9 +185,12 @@ func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir, mountPr
return nil, err
}
// skip if the hostDir path doesn't exist
- if _, err = os.Stat(hostDir); os.IsNotExist(err) {
- logrus.Warnf("%q doesn't exist, skipping", hostDir)
- continue
+ if _, err = os.Stat(hostDir); err != nil {
+ if os.IsNotExist(err) {
+ logrus.Warnf("Path %q from %q doesn't exist, skipping", hostDir, filePath)
+ continue
+ }
+ return nil, errors.Wrapf(err, "failed to stat %q", hostDir)
}
ctrDirOnHost := filepath.Join(containerWorkingDir, ctrDir)
@@ -195,7 +199,7 @@ func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir, mountPr
_, err = os.Stat(ctrDirOnHost)
if os.IsNotExist(err) {
if err = os.MkdirAll(ctrDirOnHost, 0755); err != nil {
- return nil, errors.Wrapf(err, "making container directory failed")
+ return nil, errors.Wrapf(err, "making container directory %q failed", ctrDirOnHost)
}
hostDir, err = resolveSymbolicLink(hostDir)
if err != nil {