mirror of
https://github.com/containers/podman.git
synced 2025-05-21 09:05:56 +08:00
*: 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
This commit is contained in:

committed by
Atomic Bot

parent
c32c491869
commit
fd12c8918b
@ -79,7 +79,7 @@ func getTestContainer(id, name, locksDir string) (*Container, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ctr.config.Spec = g.Spec()
|
ctr.config.Spec = g.Config
|
||||||
|
|
||||||
ctr.config.Labels["test"] = "testing"
|
ctr.config.Labels["test"] = "testing"
|
||||||
|
|
||||||
|
@ -1247,7 +1247,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
if !rootless.IsRootless() {
|
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")
|
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
|
// Look up and add groups the user belongs to, if a group wasn't directly specified
|
||||||
if !rootless.IsRootless() && !strings.Contains(c.config.User, ":") {
|
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 {
|
if err != nil && errors.Cause(err) != chrootuser.ErrNoSuchUser {
|
||||||
return nil, err
|
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.AddAnnotation("org.opencontainers.image.stopSignal", fmt.Sprintf("%d", c.config.StopSignal))
|
||||||
|
|
||||||
g.SetHostname(c.Hostname())
|
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
|
// Only add container environment variable if not already present
|
||||||
foundContainerEnv := false
|
foundContainerEnv := false
|
||||||
for _, env := range g.Spec().Process.Env {
|
for _, env := range g.Config.Process.Env {
|
||||||
if strings.HasPrefix(env, "container=") {
|
if strings.HasPrefix(env, "container=") {
|
||||||
foundContainerEnv = true
|
foundContainerEnv = true
|
||||||
break
|
break
|
||||||
@ -1376,7 +1376,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
|
|||||||
g.SetLinuxCgroupsPath(cgroupPath)
|
g.SetLinuxCgroupsPath(cgroupPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
return g.Spec(), nil
|
return g.Config, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an existing container's namespace to the spec
|
// Add an existing container's namespace to the spec
|
||||||
@ -1511,7 +1511,7 @@ func (c *Container) saveSpec(spec *spec.Spec) error {
|
|||||||
return nil
|
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 == "" {
|
if c.runtime.config.HooksDir == "" {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -1552,5 +1552,5 @@ func (c *Container) setupOCIHooks(ctx context.Context, g *generate.Generator) (e
|
|||||||
return nil, nil
|
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)
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint
|
|||||||
if err := addIpcNS(config, &g); err != nil {
|
if err := addIpcNS(config, &g); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
configSpec := g.Spec()
|
configSpec := g.Config
|
||||||
|
|
||||||
// HANDLE CAPABILITIES
|
// HANDLE CAPABILITIES
|
||||||
// NOTE: Must happen before SECCOMP
|
// NOTE: Must happen before SECCOMP
|
||||||
|
Reference in New Issue
Block a user