Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libpod/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
14 changes: 7 additions & 7 deletions libpod/container_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion pkg/spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down