summaryrefslogtreecommitdiff
path: root/libpod/util.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-10-29 13:33:44 -0400
committerNalin Dahyabhai <nalin@redhat.com>2019-10-29 13:43:45 -0400
commit66c126d6dee178f96f8a120f13372802d46ea9b5 (patch)
tree14bbd3c7fd16993234d482caa1f8b78e4954a106 /libpod/util.go
parent248bb61b14a3f0d4e1d244eff85b30f48554a6a8 (diff)
downloadpodman-66c126d6dee178f96f8a120f13372802d46ea9b5.tar.gz
podman-66c126d6dee178f96f8a120f13372802d46ea9b5.tar.bz2
podman-66c126d6dee178f96f8a120f13372802d46ea9b5.zip
Set default seccomp.json file for podman play kube
Currently podman play kube is not using the system default seccomp.json file. This PR will use the default or override location for podman play. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/util.go')
-rw-r--r--libpod/util.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/libpod/util.go b/libpod/util.go
index 84fd490bf..5ae5ab491 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -189,3 +189,20 @@ func programVersion(mountProgram string) (string, error) {
}
return strings.TrimSuffix(output, "\n"), nil
}
+
+func DefaultSeccompPath() (string, error) {
+ _, err := os.Stat(SeccompOverridePath)
+ if err == nil {
+ return SeccompOverridePath, nil
+ }
+ if !os.IsNotExist(err) {
+ return "", errors.Wrapf(err, "can't check if %q exists", SeccompOverridePath)
+ }
+ if _, err := os.Stat(SeccompDefaultPath); err != nil {
+ if !os.IsNotExist(err) {
+ return "", errors.Wrapf(err, "can't check if %q exists", SeccompDefaultPath)
+ }
+ return "", nil
+ }
+ return SeccompDefaultPath, nil
+}