Skip to content

Commit

Permalink
Merge pull request containers#823 from edsantiago/helper_override
Browse files Browse the repository at this point in the history
FindHelperBinary(): allow override via envariable
  • Loading branch information
openshift-merge-robot authored Nov 11, 2021
2 parents ad255e2 + aa9ec78 commit e31c00b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,14 @@ func (c *Config) ActiveDestination() (uri, identity string, err error) {
// FindHelperBinary will search the given binary name in the configured directories.
// If searchPATH is set to true it will also search in $PATH.
func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error) {
for _, path := range c.Engine.HelperBinariesDir {
dir_list := c.Engine.HelperBinariesDir

// If set, search this directory first. This is used in testing.
if dir, found := os.LookupEnv("CONTAINERS_HELPER_BINARY_DIR"); found {
dir_list = append([]string{dir}, dir_list...)
}

for _, path := range dir_list {
fullpath := filepath.Join(path, name)
if fi, err := os.Stat(fullpath); err == nil && fi.Mode().IsRegular() {
return fullpath, nil
Expand Down

0 comments on commit e31c00b

Please sign in to comment.