Skip to content

Commit 4e7d15f

Browse files
committed
*: Replace Generator.Spec() with Generator.Config
Catching up with opencontainers/runtime-tools@84a62c6a (generate: Move Generator.spec to Generator.Config, 2016-11-06, containers#266, v0.6.0), now that we've bumped runtime-tools in f6c0fc1 (Vendor in latest runtime-tools, 2018-06-26, containers#1007). Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent c32c491 commit 4e7d15f

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

libpod/common_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func getTestContainer(id, name, locksDir string) (*Container, error) {
7979
if err != nil {
8080
return nil, err
8181
}
82-
ctr.config.Spec = g.Spec()
82+
ctr.config.Spec = g.Config
8383

8484
ctr.config.Labels["test"] = "testing"
8585

libpod/container_internal.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
12471247

12481248
var err error
12491249
if !rootless.IsRootless() {
1250-
if c.state.ExtensionStageHooks, err = c.setupOCIHooks(ctx, &g); err != nil {
1250+
if c.state.ExtensionStageHooks, err = c.setupOCIHooks(ctx, g.Config); err != nil {
12511251
return nil, errors.Wrapf(err, "error setting up OCI Hooks")
12521252
}
12531253
}
@@ -1287,7 +1287,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
12871287

12881288
// Look up and add groups the user belongs to, if a group wasn't directly specified
12891289
if !rootless.IsRootless() && !strings.Contains(c.config.User, ":") {
1290-
groups, err := chrootuser.GetAdditionalGroupsForUser(c.state.Mountpoint, uint64(g.Spec().Process.User.UID))
1290+
groups, err := chrootuser.GetAdditionalGroupsForUser(c.state.Mountpoint, uint64(g.Config.Process.User.UID))
12911291
if err != nil && errors.Cause(err) != chrootuser.ErrNoSuchUser {
12921292
return nil, err
12931293
}
@@ -1344,11 +1344,11 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
13441344
g.AddAnnotation("org.opencontainers.image.stopSignal", fmt.Sprintf("%d", c.config.StopSignal))
13451345

13461346
g.SetHostname(c.Hostname())
1347-
g.AddProcessEnv("HOSTNAME", g.Spec().Hostname)
1347+
g.AddProcessEnv("HOSTNAME", g.Config.Hostname)
13481348

13491349
// Only add container environment variable if not already present
13501350
foundContainerEnv := false
1351-
for _, env := range g.Spec().Process.Env {
1351+
for _, env := range g.Config.Process.Env {
13521352
if strings.HasPrefix(env, "container=") {
13531353
foundContainerEnv = true
13541354
break
@@ -1376,7 +1376,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
13761376
g.SetLinuxCgroupsPath(cgroupPath)
13771377
}
13781378

1379-
return g.Spec(), nil
1379+
return g.Config, nil
13801380
}
13811381

13821382
// Add an existing container's namespace to the spec
@@ -1511,7 +1511,7 @@ func (c *Container) saveSpec(spec *spec.Spec) error {
15111511
return nil
15121512
}
15131513

1514-
func (c *Container) setupOCIHooks(ctx context.Context, g *generate.Generator) (extensionStageHooks map[string][]spec.Hook, err error) {
1514+
func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (extensionStageHooks map[string][]spec.Hook, err error) {
15151515
if c.runtime.config.HooksDir == "" {
15161516
return nil, nil
15171517
}
@@ -1552,5 +1552,5 @@ func (c *Container) setupOCIHooks(ctx context.Context, g *generate.Generator) (e
15521552
return nil, nil
15531553
}
15541554

1555-
return manager.Hooks(g.Spec(), c.Spec().Annotations, len(c.config.UserVolumes) > 0)
1555+
return manager.Hooks(config, c.Spec().Annotations, len(c.config.UserVolumes) > 0)
15561556
}

pkg/spec/spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint
223223
if err := addIpcNS(config, &g); err != nil {
224224
return nil, err
225225
}
226-
configSpec := g.Spec()
226+
configSpec := g.Config
227227

228228
// HANDLE CAPABILITIES
229229
// NOTE: Must happen before SECCOMP

0 commit comments

Comments
 (0)