diff options
author | W. Trevor King <wking@tremily.us> | 2018-06-27 09:14:13 -0700 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-27 21:27:19 +0000 |
commit | fd12c8918b0c1e1b481c0ab8573263314fe30db4 (patch) | |
tree | 21846b0ebba446004e5e2aa1ee0b9c551d178d0f | |
parent | c32c491869c58e9b0f70ebc58221c28b342f1e1d (diff) | |
download | podman-fd12c8918b0c1e1b481c0ab8573263314fe30db4.tar.gz podman-fd12c8918b0c1e1b481c0ab8573263314fe30db4.tar.bz2 podman-fd12c8918b0c1e1b481c0ab8573263314fe30db4.zip |
*: Replace Generator.Spec() with Generator.Config
Catching up with opencontainers/runtime-tools@84a62c6a (generate: Move
Generator.spec to Generator.Config, 2016-11-06, #266, v0.6.0), now
that we've bumped runtime-tools in f6c0fc1a (Vendor in latest
runtime-tools, 2018-06-26, #1007).
Signed-off-by: W. Trevor King <wking@tremily.us>
Closes: #1008
Approved by: mheon
-rw-r--r-- | libpod/common_test.go | 2 | ||||
-rw-r--r-- | libpod/container_internal.go | 14 | ||||
-rw-r--r-- | pkg/spec/spec.go | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/libpod/common_test.go b/libpod/common_test.go index 496b8d17a..d2379c508 100644 --- a/libpod/common_test.go +++ b/libpod/common_test.go @@ -79,7 +79,7 @@ func getTestContainer(id, name, locksDir string) (*Container, error) { if err != nil { return nil, err } - ctr.config.Spec = g.Spec() + ctr.config.Spec = g.Config ctr.config.Labels["test"] = "testing" diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 9d5335780..ba6cbe5aa 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1247,7 +1247,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { var err error if !rootless.IsRootless() { - if c.state.ExtensionStageHooks, err = c.setupOCIHooks(ctx, &g); err != nil { + if c.state.ExtensionStageHooks, err = c.setupOCIHooks(ctx, g.Config); err != nil { return nil, errors.Wrapf(err, "error setting up OCI Hooks") } } @@ -1287,7 +1287,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { // Look up and add groups the user belongs to, if a group wasn't directly specified if !rootless.IsRootless() && !strings.Contains(c.config.User, ":") { - groups, err := chrootuser.GetAdditionalGroupsForUser(c.state.Mountpoint, uint64(g.Spec().Process.User.UID)) + groups, err := chrootuser.GetAdditionalGroupsForUser(c.state.Mountpoint, uint64(g.Config.Process.User.UID)) if err != nil && errors.Cause(err) != chrootuser.ErrNoSuchUser { return nil, err } @@ -1344,11 +1344,11 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { g.AddAnnotation("org.opencontainers.image.stopSignal", fmt.Sprintf("%d", c.config.StopSignal)) g.SetHostname(c.Hostname()) - g.AddProcessEnv("HOSTNAME", g.Spec().Hostname) + g.AddProcessEnv("HOSTNAME", g.Config.Hostname) // Only add container environment variable if not already present foundContainerEnv := false - for _, env := range g.Spec().Process.Env { + for _, env := range g.Config.Process.Env { if strings.HasPrefix(env, "container=") { foundContainerEnv = true break @@ -1376,7 +1376,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { g.SetLinuxCgroupsPath(cgroupPath) } - return g.Spec(), nil + return g.Config, nil } // Add an existing container's namespace to the spec @@ -1511,7 +1511,7 @@ func (c *Container) saveSpec(spec *spec.Spec) error { return nil } -func (c *Container) setupOCIHooks(ctx context.Context, g *generate.Generator) (extensionStageHooks map[string][]spec.Hook, err error) { +func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (extensionStageHooks map[string][]spec.Hook, err error) { if c.runtime.config.HooksDir == "" { return nil, nil } @@ -1552,5 +1552,5 @@ func (c *Container) setupOCIHooks(ctx context.Context, g *generate.Generator) (e return nil, nil } - return manager.Hooks(g.Spec(), c.Spec().Annotations, len(c.config.UserVolumes) > 0) + return manager.Hooks(config, c.Spec().Annotations, len(c.config.UserVolumes) > 0) } diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index d407b419a..2cef3ecc0 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -223,7 +223,7 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint if err := addIpcNS(config, &g); err != nil { return nil, err } - configSpec := g.Spec() + configSpec := g.Config // HANDLE CAPABILITIES // NOTE: Must happen before SECCOMP |