mirror of
https://github.com/containers/podman.git
synced 2025-12-05 12:52:12 +08:00
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
This commit is contained in:
@@ -753,7 +753,7 @@ func (c *Container) makeBindMounts() error {
|
||||
}
|
||||
|
||||
// Add Secret Mounts
|
||||
secretMounts := secrets.SecretMounts(c.config.MountLabel, c.state.RunDir)
|
||||
secretMounts := secrets.SecretMounts(c.config.MountLabel, c.state.RunDir, c.runtime.config.DefaultMountsFile)
|
||||
for _, mount := range secretMounts {
|
||||
if _, ok := c.state.BindMounts[mount.Destination]; !ok {
|
||||
c.state.BindMounts[mount.Destination] = mount.Source
|
||||
|
||||
@@ -186,6 +186,19 @@ func WithHooksDir(hooksDir string) RuntimeOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithDefaultMountsFile sets the file to look at for default mounts (mainly secrets)
|
||||
// Note we are not saving this in the database as it is for testing purposes only
|
||||
func WithDefaultMountsFile(mountsFile string) RuntimeOption {
|
||||
return func(rt *Runtime) error {
|
||||
if rt.valid {
|
||||
return ErrRuntimeFinalized
|
||||
}
|
||||
|
||||
rt.config.DefaultMountsFile = []string{mountsFile}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithTmpDir sets the directory that temporary runtime files which are not
|
||||
// expected to survive across reboots will be stored
|
||||
// This should be located on a tmpfs mount (/tmp or /var/run for example)
|
||||
|
||||
@@ -131,6 +131,8 @@ type RuntimeConfig struct {
|
||||
CNIPluginDir []string `toml:"cni_plugin_dir"`
|
||||
// HooksDir Path to the directory containing hooks configuration files
|
||||
HooksDir string `toml:"hooks_dir"`
|
||||
// DefaultMountsFile is the path to the default mounts file for testing purposes only
|
||||
DefaultMountsFile []string `toml:"-"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user