Skip to content

Commit

Permalink
Merge pull request #164 from rhatdan/conf
Browse files Browse the repository at this point in the history
Add full path for error messages on containers.conf
  • Loading branch information
vrothberg authored May 27, 2020
2 parents 6d4044e + cd51abb commit 0e6180b
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 libpod.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 0e6180b

Please sign in to comment.