aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-05 13:15:20 +0100
committerGitHub <noreply@github.com>2019-02-05 13:15:20 +0100
commitb1d4dbd335f4801487ef86964b6833c3604ceef5 (patch)
treedcd25fb2a8542a339f3c51dc56bbbbdea06fd7bb
parent778f9867fdf0e5c777f6391f847b04758cab5d45 (diff)
parent61979d8ac27452fe6eb4c5e77278a2e9216a2d29 (diff)
downloadpodman-b1d4dbd335f4801487ef86964b6833c3604ceef5.tar.gz
podman-b1d4dbd335f4801487ef86964b6833c3604ceef5.tar.bz2
podman-b1d4dbd335f4801487ef86964b6833c3604ceef5.zip
Merge pull request #2222 from giuseppe/rootless-copy-paths-global-conf
rootless: copy some settings from the global configuration
-rw-r--r--libpod/runtime.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index c7000d84a..c975f628b 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -385,6 +385,28 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) {
if _, err := toml.Decode(string(contents), runtime.config); err != nil {
return nil, errors.Wrapf(err, "error decoding configuration file %s", configPath)
}
+ } else if rootless.IsRootless() {
+ // If the configuration file was not found but we are running in rootless, a subset of the
+ // global config file is used.
+ for _, path := range []string{OverrideConfigPath, ConfigPath} {
+ contents, err := ioutil.ReadFile(OverrideConfigPath)
+ if err != nil {
+ // Ignore any error, the file might not be readable by us.
+ continue
+ }
+ tmpConfig := new(RuntimeConfig)
+ if _, err := toml.Decode(string(contents), tmpConfig); err != nil {
+ return nil, errors.Wrapf(err, "error decoding configuration file %s", path)
+ }
+
+ // Cherry pick the settings we want from the global configuration
+ runtime.config.ConmonPath = tmpConfig.ConmonPath
+ runtime.config.ConmonEnvVars = tmpConfig.ConmonEnvVars
+ runtime.config.OCIRuntimes = tmpConfig.OCIRuntimes
+ runtime.config.CNIPluginDir = tmpConfig.CNIPluginDir
+ runtime.config.NoPivotRoot = tmpConfig.NoPivotRoot
+ break
+ }
}
// Overwrite config with user-given configuration options