Skip to content

Commit

Permalink
Merge pull request #2078 from rhatdan/config.file
Browse files Browse the repository at this point in the history
Add the configuration file used to setup storage to podman info
  • Loading branch information
openshift-merge-robot authored Jan 7, 2019
2 parents 628b14a + b367855 commit faa2462
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/podman-info.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ registries:
- docker.io
- registry.access.redhat.com
store:
ConfigFile: /etc/containers/storage.conf
ContainerStore:
number: 37
GraphDriverName: overlay
Expand Down
2 changes: 2 additions & 0 deletions libpod/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"time"

"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/util"
"github.com/containers/libpod/utils"
"github.com/containers/storage/pkg/system"
"github.com/pkg/errors"
Expand Down Expand Up @@ -115,6 +116,7 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
func (r *Runtime) storeInfo() (map[string]interface{}, error) {
// lets say storage driver in use, number of images, number of containers
info := map[string]interface{}{}
info["ConfigFile"] = util.StorageConfigFile()
info["GraphRoot"] = r.store.GraphRoot()
info["RunRoot"] = r.store.RunRoot()
info["GraphDriverName"] = r.store.GraphDriverName()
Expand Down
10 changes: 9 additions & 1 deletion pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func GetDefaultStoreOptions() (storage.StoreOptions, string, error) {
return storageOpts, volumePath, err
}

storageConf := filepath.Join(os.Getenv("HOME"), ".config/containers/storage.conf")
storageConf := StorageConfigFile()
if _, err := os.Stat(storageConf); err == nil {
storage.ReloadConfigurationFile(storageConf, &storageOpts)
} else if os.IsNotExist(err) {
Expand All @@ -334,3 +334,11 @@ func GetDefaultStoreOptions() (storage.StoreOptions, string, error) {
}
return storageOpts, volumePath, nil
}

// StorageConfigFile returns the path to the storage config file used
func StorageConfigFile() string {
if rootless.IsRootless() {
return filepath.Join(os.Getenv("HOME"), ".config/containers/storage.conf")
}
return storage.DefaultConfigFile
}
5 changes: 3 additions & 2 deletions vendor/github.com/containers/storage/store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit faa2462

Please sign in to comment.