Skip to content

Commit

Permalink
pkg/machine: fix relative DefaultPolicyJSONPath
Browse files Browse the repository at this point in the history
When we set a relative path (i.e. ".") it should be resolved next to
binary so we need to get the base dir. If we join it directly like it
did before you get a path like .../podman/policy.json where podman is the
podman executable so it is not a directory and thus could not contain the
policy.json file.

ref #21964

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Mar 7, 2024
1 parent 56e0f06 commit 2ba3a2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/machine/ocipull/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func policyPath() (string, error) {
if err != nil {
return "", fmt.Errorf("could not resolve relative path to binary: %w", err)
}
return filepath.Join(p, DefaultPolicyJSONPath, policyfile), nil
return filepath.Join(filepath.Dir(p), DefaultPolicyJSONPath, policyfile), nil
}
return "", &defaultPolicyError{errs: errs}
}

0 comments on commit 2ba3a2d

Please sign in to comment.