diff options
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libpod/options.go b/libpod/options.go index e6751d68d..977f3f4c2 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -181,7 +181,7 @@ func WithStaticDir(dir string) RuntimeOption { // WithHooksDir sets the directory to look for OCI runtime hooks config. // Note we are not saving this in database, since this is really just for used // for testing. -func WithHooksDir(hooksDir string, dirNotExistFatal bool) RuntimeOption { +func WithHooksDir(hooksDir string) RuntimeOption { return func(rt *Runtime) error { if rt.valid { return ErrRuntimeFinalized @@ -191,8 +191,8 @@ func WithHooksDir(hooksDir string, dirNotExistFatal bool) RuntimeOption { return errors.Wrap(ErrInvalidArg, "empty-string hook directories are not supported") } - rt.config.HooksDir = hooksDir - rt.config.HooksDirNotExistFatal = dirNotExistFatal + rt.config.HooksDir = []string{hooksDir} + rt.config.HooksDirNotExistFatal = true return nil } } @@ -373,15 +373,17 @@ func WithPrivileged(privileged bool) CtrCreateOption { } } -// WithSELinuxLabels sets the mount label for SELinux. -func WithSELinuxLabels(processLabel, mountLabel string) CtrCreateOption { +// WithSecLabels sets the labels for SELinux. +func WithSecLabels(labelOpts []string) CtrCreateOption { return func(ctr *Container) error { if ctr.valid { return ErrCtrFinalized } - - ctr.config.ProcessLabel = processLabel - ctr.config.MountLabel = mountLabel + var err error + ctr.config.ProcessLabel, ctr.config.MountLabel, err = ctr.runtime.initLabels(labelOpts) + if err != nil { + return errors.Wrapf(err, "failed to init labels") + } return nil } } |