summaryrefslogtreecommitdiff
path: root/pkg/secrets
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-04-26 11:29:02 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-26 16:33:25 +0000
commit6ac8a24db4ab3e2bbc85feca2bee8cb1c868c7f6 (patch)
tree7fb44c59e3c9feae18d402dda0c899a959e61459 /pkg/secrets
parentd7d0e13837a0a2ce0b5432373892d28dbbfc0342 (diff)
downloadpodman-6ac8a24db4ab3e2bbc85feca2bee8cb1c868c7f6.tar.gz
podman-6ac8a24db4ab3e2bbc85feca2bee8cb1c868c7f6.tar.bz2
podman-6ac8a24db4ab3e2bbc85feca2bee8cb1c868c7f6.zip
Add --default-mounts-file hidden flag
The hidden flag is used to override the path of the default mounts file for testing purposes. Also modified the secrets pkg to allow for this override to happen. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #678 Approved by: mheon
Diffstat (limited to 'pkg/secrets')
-rw-r--r--pkg/secrets/secrets.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/secrets/secrets.go b/pkg/secrets/secrets.go
index 9b328575b..54d1ae5ad 100644
--- a/pkg/secrets/secrets.go
+++ b/pkg/secrets/secrets.go
@@ -127,10 +127,15 @@ func getMountsMap(path string) (string, string, error) {
}
// SecretMounts copies, adds, and mounts the secrets to the container root filesystem
-func SecretMounts(mountLabel, containerWorkingDir string) []rspec.Mount {
+func SecretMounts(mountLabel, containerWorkingDir string, mountFile []string) []rspec.Mount {
var secretMounts []rspec.Mount
// Add secrets from paths given in the mounts.conf files
- for _, file := range []string{OverrideMountsFile, DefaultMountsFile} {
+ // mountFile will have a value if the hidden --default-mounts-file flag is set
+ // Note for testing purposes only
+ if len(mountFile) == 0 {
+ mountFile = append(mountFile, []string{OverrideMountsFile, DefaultMountsFile}...)
+ }
+ for _, file := range mountFile {
mounts, err := addSecretsFromMountsFile(file, mountLabel, containerWorkingDir)
if err != nil {
logrus.Warnf("error mounting secrets, skipping: %v", err)