Fix usage of oci in other packages.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin
2017-11-22 15:45:47 -05:00
parent 081f8c7ce0
commit cdf62f69a1
13 changed files with 80 additions and 68 deletions

View File

@@ -8,16 +8,16 @@ import (
"fmt"
"io/ioutil"
"github.com/containerd/containerd"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci"
"github.com/opencontainers/runtime-spec/specs-go"
)
// WithProfile receives the name of a file stored on disk comprising a json
// formated seccomp profile, as specified by the opencontainers/runtime-spec.
// The profile is read from the file, unmarshaled, and set to the spec.
func WithProfile(profile string) containerd.SpecOpts {
return func(_ context.Context, _ *containerd.Client, _ *containers.Container, s *specs.Spec) error {
func WithProfile(profile string) oci.SpecOpts {
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
s.Linux.Seccomp = &specs.LinuxSeccomp{}
f, err := ioutil.ReadFile(profile)
if err != nil {
@@ -32,8 +32,8 @@ func WithProfile(profile string) containerd.SpecOpts {
// WithDefaultProfile sets the default seccomp profile to the spec.
// Note: must follow the setting of process capabilities
func WithDefaultProfile() containerd.SpecOpts {
return func(_ context.Context, _ *containerd.Client, _ *containers.Container, s *specs.Spec) error {
func WithDefaultProfile() oci.SpecOpts {
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
s.Linux.Seccomp = DefaultProfile(s)
return nil
}