summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-03-09 11:06:21 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-03-09 12:54:23 +0100
commit6d4899745c43bb43c03dcb1114513f370996d757 (patch)
tree64dd5507af7dd4c574bc2d76dfebfc94caed6870
parent789d579bc43cab0a179a17276478100b4b80e6fc (diff)
downloadpodman-6d4899745c43bb43c03dcb1114513f370996d757.tar.gz
podman-6d4899745c43bb43c03dcb1114513f370996d757.tar.bz2
podman-6d4899745c43bb43c03dcb1114513f370996d757.zip
options: append CLI graph driver options
if --storage-opt are specified on the CLI append them after what is specified in the configuration files instead of overriding it. Closes: https://github.com/containers/podman/issues/9657 [NO TESTS NEEDED] Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--libpod/options.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 6344e1acc..48888a2f2 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -64,15 +64,22 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
setField = true
}
+ graphDriverChanged := false
if config.GraphDriverName != "" {
rt.storageConfig.GraphDriverName = config.GraphDriverName
rt.storageSet.GraphDriverNameSet = true
setField = true
+ graphDriverChanged = true
}
if config.GraphDriverOptions != nil {
- rt.storageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
- copy(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions)
+ if graphDriverChanged {
+ rt.storageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
+ copy(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions)
+ } else {
+ // append new options after what is specified in the config files
+ rt.storageConfig.GraphDriverOptions = append(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions...)
+ }
setField = true
}