Skip to content

Commit

Permalink
Add full path for error messages on containers.conf
Browse files Browse the repository at this point in the history
Also add new function to allow container engines to tell users
where to edit containers.conf file.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed May 26, 2020
1 parent 55f4466 commit 47a11f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,3 +878,16 @@ func Default() (*Config, error) {
})
return config, err
}

func Path() string {
if path := os.Getenv("CONTAINERS_CONF"); path != "" {
return path
}
if unshare.IsRootless() {
if rpath, err := rootlessConfigPath(); err == nil {
return rpath
}
return "$HOME/" + UserOverrideContainersConfig
}
return OverrideContainersConfig
}
4 changes: 2 additions & 2 deletions pkg/config/libpodConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func newLibpodConfig(c *Config) error {

// hard code EventsLogger to "file" to match older podman versions.
if config.EventsLogger != "file" {
logrus.Debugf("Ignoring lipod.conf EventsLogger setting %q. Use containers.conf if you want to change this setting and remove libpod.conf files.", config.EventsLogger)
logrus.Debugf("Ignoring lipod.conf EventsLogger setting %q. Use %q if you want to change this setting and remove libpod.conf files.", Path(), config.EventsLogger)
config.EventsLogger = "file"
}

Expand Down Expand Up @@ -262,7 +262,7 @@ func systemLibpodConfigs() ([]string, error) {
}
// TODO: Raise to Warnf, when Podman is updated to
// remove libpod.conf by default
logrus.Debugf("Found deprecated file %s, please remove. Use %s to override defaults.\n", path, containersConfPath)
logrus.Debugf("Found deprecated file %s, please remove. Use %s to override defaults.\n", Path(), containersConfPath)
return []string{path}, nil
}
return nil, err
Expand Down

0 comments on commit 47a11f2

Please sign in to comment.