From 68a0b369a26eca6b4e3445fb5e8e0da162279564 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 26 Oct 2022 12:10:09 -0400 Subject: [PATCH] Expose System wide config file Currently Podman warns when attempting to reset storage, if the system wide storage.conf file /usr/share/containers/storage.conf exists. Since distros ship this, we need to allow Podman to check if the default is the System default and therefore do not warn. Signed-off-by: Daniel J Walsh --- types/options.go | 5 +++++ types/options_darwin.go | 6 +----- types/options_freebsd.go | 5 +---- types/options_linux.go | 5 +---- types/options_windows.go | 5 +---- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/types/options.go b/types/options.go index 68a91239bc..45daa24edd 100644 --- a/types/options.go +++ b/types/options.go @@ -38,6 +38,11 @@ var ( once sync.Once storeOptions StoreOptions storeError error + defaultConfigFileSet bool + // defaultConfigFile path to the system wide storage.conf file + defaultConfigFile = SystemConfigFile + // DefaultStoreOptions is a reasonable default set of options. + defaultStoreOptions StoreOptions ) func loadDefaultStoreOptions() { diff --git a/types/options_darwin.go b/types/options_darwin.go index d5ad50bc0b..eed1a3d94b 100644 --- a/types/options_darwin.go +++ b/types/options_darwin.go @@ -5,13 +5,9 @@ const ( // for rootless path is constructed via getRootlessStorageOpts defaultRunRoot string = "/run/containers/storage" defaultGraphRoot string = "/var/lib/containers/storage" + SystemConfigFile = "/usr/share/containers/storage.conf" ) -// defaultConfigFile path to the system wide storage.conf file var ( - defaultConfigFile = "/usr/share/containers/storage.conf" defaultOverrideConfigFile = "/etc/containers/storage.conf" - defaultConfigFileSet = false - // DefaultStoreOptions is a reasonable default set of options. - defaultStoreOptions StoreOptions ) diff --git a/types/options_freebsd.go b/types/options_freebsd.go index d5976b6d58..afb7ec6b4a 100644 --- a/types/options_freebsd.go +++ b/types/options_freebsd.go @@ -5,13 +5,10 @@ const ( // for rootless path is constructed via getRootlessStorageOpts defaultRunRoot string = "/var/run/containers/storage" defaultGraphRoot string = "/var/db/containers/storage" + SystemConfigFile = "/usr/local/share/containers/storage.conf" ) // defaultConfigFile path to the system wide storage.conf file var ( - defaultConfigFile = "/usr/local/share/containers/storage.conf" defaultOverrideConfigFile = "/usr/local/etc/containers/storage.conf" - defaultConfigFileSet = false - // DefaultStoreOptions is a reasonable default set of options. - defaultStoreOptions StoreOptions ) diff --git a/types/options_linux.go b/types/options_linux.go index d5ad50bc0b..d44aaf76a3 100644 --- a/types/options_linux.go +++ b/types/options_linux.go @@ -5,13 +5,10 @@ const ( // for rootless path is constructed via getRootlessStorageOpts defaultRunRoot string = "/run/containers/storage" defaultGraphRoot string = "/var/lib/containers/storage" + SystemConfigFile = "/usr/share/containers/storage.conf" ) // defaultConfigFile path to the system wide storage.conf file var ( - defaultConfigFile = "/usr/share/containers/storage.conf" defaultOverrideConfigFile = "/etc/containers/storage.conf" - defaultConfigFileSet = false - // DefaultStoreOptions is a reasonable default set of options. - defaultStoreOptions StoreOptions ) diff --git a/types/options_windows.go b/types/options_windows.go index d5ad50bc0b..d44aaf76a3 100644 --- a/types/options_windows.go +++ b/types/options_windows.go @@ -5,13 +5,10 @@ const ( // for rootless path is constructed via getRootlessStorageOpts defaultRunRoot string = "/run/containers/storage" defaultGraphRoot string = "/var/lib/containers/storage" + SystemConfigFile = "/usr/share/containers/storage.conf" ) // defaultConfigFile path to the system wide storage.conf file var ( - defaultConfigFile = "/usr/share/containers/storage.conf" defaultOverrideConfigFile = "/etc/containers/storage.conf" - defaultConfigFileSet = false - // DefaultStoreOptions is a reasonable default set of options. - defaultStoreOptions StoreOptions )