Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions common/pkg/config/modules.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package config

import "go.podman.io/storage/pkg/configfile"

// LoadedModules returns absolute paths to loaded containers.conf modules.
func (c *Config) LoadedModules() []string {
// Required for conmon's callback to Podman's cleanup.
Expand All @@ -12,6 +14,9 @@ func (c *Config) LoadedModules() []string {
// 2) /etc/
// 3) /usr/share.
func ModuleDirectories() ([]string, error) { // Public API for shell completions in Podman
// FIXME: expose this again
return nil, nil
conf := defaultConfigFileOpts()
// API needs us to pass an non empty string to trigger module path resolution
conf.Modules = []string{""}
paths, err := configfile.GetSearchPaths(conf)
return paths.ModuleDirectories, err
}
9 changes: 9 additions & 0 deletions common/pkg/config/modules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,13 @@ var _ = Describe("Config Modules", func() {
gomega.Expect(c.Containers.Env.Get()).To(gomega.Equal([]string{"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "usr share only", "override conf always wins"}))
gomega.Expect(c.Containers.Volumes.Get()).To(gomega.Equal([]string{"volume four", "home second"}))
})

It("new config with modules and env variables", func() {
paths, err := ModuleDirectories()
gomega.Expect(err).ToNot(gomega.HaveOccurred())
gomega.Expect(paths).To(gomega.HaveLen(3))
for _, path := range paths {
gomega.Expect(path).To(gomega.HaveSuffix("containers.conf.modules"))
}
})
})
Loading