Switch all referencs to image.ContainerConfig to image.Config

This will more closely match what Docker is doing.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2018-12-18 11:44:19 -05:00
parent fe186c6ebb
commit c657dc4fdb
22 changed files with 113 additions and 113 deletions

@ -344,7 +344,7 @@ func configureEntrypoint(c *cli.Context, data *inspect.ImageData) []string {
return []string{c.String("entrypoint")} return []string{c.String("entrypoint")}
} }
if data != nil { if data != nil {
return data.ContainerConfig.Entrypoint return data.Config.Entrypoint
} }
return entrypoint return entrypoint
} }
@ -474,7 +474,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
// EXPOSED PORTS // EXPOSED PORTS
var portBindings map[nat.Port][]nat.PortBinding var portBindings map[nat.Port][]nat.PortBinding
if data != nil { if data != nil {
portBindings, err = cc.ExposedPorts(c.StringSlice("expose"), c.StringSlice("publish"), c.Bool("publish-all"), data.ContainerConfig.ExposedPorts) portBindings, err = cc.ExposedPorts(c.StringSlice("expose"), c.StringSlice("publish"), c.Bool("publish-all"), data.Config.ExposedPorts)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -567,7 +567,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
if data == nil { if data == nil {
user = "0" user = "0"
} else { } else {
user = data.ContainerConfig.User user = data.Config.User
} }
} }
@ -575,7 +575,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
stopSignal := syscall.SIGTERM stopSignal := syscall.SIGTERM
signalString := "" signalString := ""
if data != nil { if data != nil {
signalString = data.ContainerConfig.StopSignal signalString = data.Config.StopSignal
} }
if c.IsSet("stop-signal") { if c.IsSet("stop-signal") {
signalString = c.String("stop-signal") signalString = c.String("stop-signal")
@ -590,7 +590,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
// ENVIRONMENT VARIABLES // ENVIRONMENT VARIABLES
env := defaultEnvVariables env := defaultEnvVariables
if data != nil { if data != nil {
for _, e := range data.ContainerConfig.Env { for _, e := range data.Config.Env {
split := strings.SplitN(e, "=", 2) split := strings.SplitN(e, "=", 2)
if len(split) > 1 { if len(split) > 1 {
env[split[0]] = split[1] env[split[0]] = split[1]
@ -609,7 +609,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
return nil, errors.Wrapf(err, "unable to process labels") return nil, errors.Wrapf(err, "unable to process labels")
} }
if data != nil { if data != nil {
for key, val := range data.ContainerConfig.Labels { for key, val := range data.Config.Labels {
if _, ok := labels[key]; !ok { if _, ok := labels[key]; !ok {
labels[key] = val labels[key] = val
} }
@ -643,8 +643,8 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
workDir := "/" workDir := "/"
if c.IsSet("workdir") || c.IsSet("w") { if c.IsSet("workdir") || c.IsSet("w") {
workDir = c.String("workdir") workDir = c.String("workdir")
} else if data != nil && data.ContainerConfig.WorkingDir != "" { } else if data != nil && data.Config.WorkingDir != "" {
workDir = data.ContainerConfig.WorkingDir workDir = data.Config.WorkingDir
} }
entrypoint := configureEntrypoint(c, data) entrypoint := configureEntrypoint(c, data)
@ -656,9 +656,9 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
if len(inputCommand) > 0 { if len(inputCommand) > 0 {
// User command overrides data CMD // User command overrides data CMD
command = append(command, inputCommand...) command = append(command, inputCommand...)
} else if data != nil && len(data.ContainerConfig.Cmd) > 0 && !c.IsSet("entrypoint") { } else if data != nil && len(data.Config.Cmd) > 0 && !c.IsSet("entrypoint") {
// If not user command, add CMD // If not user command, add CMD
command = append(command, data.ContainerConfig.Cmd...) command = append(command, data.Config.Cmd...)
} }
if data != nil && len(command) == 0 { if data != nil && len(command) == 0 {
@ -697,7 +697,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
var ImageVolumes map[string]struct{} var ImageVolumes map[string]struct{}
if data != nil { if data != nil {
ImageVolumes = data.ContainerConfig.Volumes ImageVolumes = data.Config.Volumes
} }
var imageVolType = map[string]string{ var imageVolType = map[string]string{
"bind": "", "bind": "",

@ -125,11 +125,11 @@ type Config struct {
// don't result in runnable images on their own. // don't result in runnable images on their own.
// github.com/docker/distribution/manifest/schema1/config_builder.go // github.com/docker/distribution/manifest/schema1/config_builder.go
type V1Compatibility struct { type V1Compatibility struct {
ID string `json:"id"` ID string `json:"id"`
Parent string `json:"parent,omitempty"` Parent string `json:"parent,omitempty"`
Comment string `json:"comment,omitempty"` Comment string `json:"comment,omitempty"`
Created time.Time `json:"created"` Created time.Time `json:"created"`
ContainerConfig struct { Config struct {
Cmd []string Cmd []string
} `json:"container_config,omitempty"` } `json:"container_config,omitempty"`
Author string `json:"author,omitempty"` Author string `json:"author,omitempty"`

@ -39,15 +39,15 @@ func generateAlpineImageData() *inspect.ImageData {
} }
data := &inspect.ImageData{ data := &inspect.ImageData{
ID: "e21c333399e0aeedfd70e8827c9fba3f8e9b170ef8a48a29945eb7702bf6aa5f", ID: "e21c333399e0aeedfd70e8827c9fba3f8e9b170ef8a48a29945eb7702bf6aa5f",
RepoTags: []string{"docker.io/library/alpine:latest"}, RepoTags: []string{"docker.io/library/alpine:latest"},
RepoDigests: []string{"docker.io/library/alpine@sha256:5cb04fce748f576d7b72a37850641de8bd725365519673c643ef2d14819b42c6"}, RepoDigests: []string{"docker.io/library/alpine@sha256:5cb04fce748f576d7b72a37850641de8bd725365519673c643ef2d14819b42c6"},
Comment: "Created:2017-12-01 18:48:48.949613376 +0000", Comment: "Created:2017-12-01 18:48:48.949613376 +0000",
Author: "", Author: "",
Architecture: "amd64", Architecture: "amd64",
Os: "linux", Os: "linux",
Version: "17.06.2-ce", Version: "17.06.2-ce",
ContainerConfig: config, Config: config,
} }
return data return data
} }

@ -51,7 +51,7 @@ type PsOptions struct {
// BatchContainerStruct is the return obkect from BatchContainer and contains // BatchContainerStruct is the return obkect from BatchContainer and contains
// container related information // container related information
type BatchContainerStruct struct { type BatchContainerStruct struct {
ConConfig *libpod.ContainerConfig ConConfig *libpod.Config
ConState libpod.ContainerStatus ConState libpod.ContainerStatus
ExitCode int32 ExitCode int32
Exited bool Exited bool
@ -328,7 +328,7 @@ func PBatch(containers []*libpod.Container, workers int, opts PsOptions) []PsCon
// locks. // locks.
func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStruct, error) { func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStruct, error) {
var ( var (
conConfig *libpod.ContainerConfig conConfig *libpod.Config
conState libpod.ContainerStatus conState libpod.ContainerStatus
err error err error
exitCode int32 exitCode int32

@ -41,8 +41,8 @@ class Image(collections.UserDict):
details = self.inspect() details = self.inspect()
config = ConfigDict(image_id=self._id, **kwargs) config = ConfigDict(image_id=self._id, **kwargs)
config['command'] = details.containerconfig.get('cmd') config['command'] = details.config.get('cmd')
config['env'] = self._split_token(details.containerconfig.get('env')) config['env'] = self._split_token(details.config.get('env'))
config['image'] = copy.deepcopy(details.repotags[0]) config['image'] = copy.deepcopy(details.repotags[0])
config['labels'] = copy.deepcopy(details.labels) config['labels'] = copy.deepcopy(details.labels)
config['net_mode'] = 'bridge' config['net_mode'] = 'bridge'

@ -140,7 +140,7 @@ class TestContainers(PodmanTestCase):
# TODO: Test for STOPSIGNAL when supported by OCI # TODO: Test for STOPSIGNAL when supported by OCI
# TODO: Test for message when supported by OCI # TODO: Test for message when supported by OCI
details = self.pclient.images.get(self.alpine_ctnr.image).inspect() details = self.pclient.images.get(self.alpine_ctnr.image).inspect()
changes = ['ENV=' + i for i in details.containerconfig['env']] changes = ['ENV=' + i for i in details.config['env']]
changes.append('CMD=/usr/bin/zsh') changes.append('CMD=/usr/bin/zsh')
changes.append('ENTRYPOINT=/bin/sh date') changes.append('ENTRYPOINT=/bin/sh date')
changes.append('ENV=TEST=test_containers.TestContainers.test_commit') changes.append('ENV=TEST=test_containers.TestContainers.test_commit')
@ -158,22 +158,22 @@ class TestContainers(PodmanTestCase):
details = img.inspect() details = img.inspect()
self.assertEqual(details.author, 'Bozo the clown') self.assertEqual(details.author, 'Bozo the clown')
self.assertListEqual(['/usr/bin/zsh'], details.containerconfig['cmd']) self.assertListEqual(['/usr/bin/zsh'], details.config['cmd'])
self.assertListEqual(['/bin/sh date'], self.assertListEqual(['/bin/sh date'],
details.containerconfig['entrypoint']) details.config['entrypoint'])
self.assertIn('TEST=test_containers.TestContainers.test_commit', self.assertIn('TEST=test_containers.TestContainers.test_commit',
details.containerconfig['env']) details.config['env'])
self.assertTrue( self.assertTrue(
[e for e in details.containerconfig['env'] if 'PATH=' in e]) [e for e in details.config['env'] if 'PATH=' in e])
self.assertDictEqual({ self.assertDictEqual({
'80': {}, '80': {},
'8888': {}, '8888': {},
}, details.containerconfig['exposedports']) }, details.config['exposedports'])
self.assertDictEqual({'unittest': 'test_commit'}, details.labels) self.assertDictEqual({'unittest': 'test_commit'}, details.labels)
self.assertEqual('bozo:circus', details.containerconfig['user']) self.assertEqual('bozo:circus', details.config['user'])
self.assertEqual({'/data': {}}, details.containerconfig['volumes']) self.assertEqual({'/data': {}}, details.config['volumes'])
self.assertEqual('/data/application', self.assertEqual('/data/application',
details.containerconfig['workingdir']) details.config['workingdir'])
def test_remove(self): def test_remove(self):
before = len(self.containers) before = len(self.containers)

@ -69,7 +69,7 @@ class TestImages(PodmanTestCase):
self.assertEqual(FoldedString(ctnr.status), 'running') self.assertEqual(FoldedString(ctnr.status), 'running')
ctnr_details = ctnr.inspect() ctnr_details = ctnr.inspect()
for e in img_details.containerconfig['env']: for e in img_details.config['env']:
self.assertIn(e, ctnr_details.config['env']) self.assertIn(e, ctnr_details.config['env'])
def test_export(self): def test_export(self):

@ -48,7 +48,7 @@ Display the total file size if the type is a container
"Parent": "", "Parent": "",
"Comment": "", "Comment": "",
"Created": "2017-11-14T21:07:08.475840838Z", "Created": "2017-11-14T21:07:08.475840838Z",
"ContainerConfig": { "Config": {
"Env": [ "Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DISTTAG=f27container", "DISTTAG=f27container",

@ -322,7 +322,7 @@ func (s *BoltState) Container(id string) (*Container, error) {
ctrID := []byte(id) ctrID := []byte(id)
ctr := new(Container) ctr := new(Container)
ctr.config = new(ContainerConfig) ctr.config = new(Config)
ctr.state = new(containerState) ctr.state = new(containerState)
db, err := s.getDBCon() db, err := s.getDBCon()
@ -358,7 +358,7 @@ func (s *BoltState) LookupContainer(idOrName string) (*Container, error) {
} }
ctr := new(Container) ctr := new(Container)
ctr.config = new(ContainerConfig) ctr.config = new(Config)
ctr.state = new(containerState) ctr.state = new(containerState)
db, err := s.getDBCon() db, err := s.getDBCon()
@ -751,7 +751,7 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
} }
ctr := new(Container) ctr := new(Container)
ctr.config = new(ContainerConfig) ctr.config = new(Config)
ctr.state = new(containerState) ctr.state = new(containerState)
if err := s.getContainerFromDB(id, ctr, ctrBucket); err != nil { if err := s.getContainerFromDB(id, ctr, ctrBucket); err != nil {
@ -1137,7 +1137,7 @@ func (s *BoltState) PodContainers(pod *Pod) ([]*Container, error) {
// Iterate through all containers in the pod // Iterate through all containers in the pod
err = podCtrs.ForEach(func(id, val []byte) error { err = podCtrs.ForEach(func(id, val []byte) error {
newCtr := new(Container) newCtr := new(Container)
newCtr.config = new(ContainerConfig) newCtr.config = new(Config)
newCtr.state = new(containerState) newCtr.state = new(containerState)
ctrs = append(ctrs, newCtr) ctrs = append(ctrs, newCtr)

@ -18,7 +18,7 @@ import (
func getTestContainer(id, name, locksDir string) (*Container, error) { func getTestContainer(id, name, locksDir string) (*Container, error) {
ctr := &Container{ ctr := &Container{
config: &ContainerConfig{ config: &Config{
ID: id, ID: id,
Name: name, Name: name,
RootfsImageID: id, RootfsImageID: id,
@ -165,8 +165,8 @@ func testContainersEqual(t *testing.T, a, b *Container, allowedEmpty bool) {
require.NotNil(t, a.state) require.NotNil(t, a.state)
require.NotNil(t, b.state) require.NotNil(t, b.state)
aConfig := new(ContainerConfig) aConfig := new(Config)
bConfig := new(ContainerConfig) bConfig := new(Config)
aState := new(containerState) aState := new(containerState)
bState := new(containerState) bState := new(containerState)

@ -112,7 +112,7 @@ func (ns LinuxNS) String() string {
// syncContainer() immediately after locking. // syncContainer() immediately after locking.
// ffjson: skip // ffjson: skip
type Container struct { type Container struct {
config *ContainerConfig config *Config
state *containerState state *containerState
@ -199,11 +199,11 @@ type ExecSession struct {
PID int `json:"pid"` PID int `json:"pid"`
} }
// ContainerConfig contains all information that was used to create the // Config contains all information that was used to create the
// container. It may not be changed once created. // container. It may not be changed once created.
// It is stored, read-only, on disk // It is stored, read-only, on disk
// easyjson:json // easyjson:json
type ContainerConfig struct { type Config struct {
Spec *spec.Spec `json:"spec"` Spec *spec.Spec `json:"spec"`
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
@ -382,8 +382,8 @@ func (t ContainerStatus) String() string {
// Unlocked // Unlocked
// Config returns the configuration used to create the container // Config returns the configuration used to create the container
func (c *Container) Config() *ContainerConfig { func (c *Container) Config() *Config {
returnConfig := new(ContainerConfig) returnConfig := new(Config)
deepcopier.Copy(c.config).To(returnConfig) deepcopier.Copy(c.config).To(returnConfig)
return returnConfig return returnConfig

@ -1238,7 +1238,7 @@ func (v *ExecSession) UnmarshalJSON(data []byte) error {
func (v *ExecSession) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ExecSession) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson1dbef17bDecodeGithubComContainersLibpodLibpod1(l, v) easyjson1dbef17bDecodeGithubComContainersLibpodLibpod1(l, v)
} }
func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *ContainerConfig) { func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *Config) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -1720,7 +1720,7 @@ func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, ou
in.Consumed() in.Consumed()
} }
} }
func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in ContainerConfig) { func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in Config) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -2415,26 +2415,26 @@ func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer,
} }
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ContainerConfig) MarshalJSON() ([]byte, error) { func (v Config) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(&w, v) easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ContainerConfig) MarshalEasyJSON(w *jwriter.Writer) { func (v Config) MarshalEasyJSON(w *jwriter.Writer) {
easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(w, v) easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ContainerConfig) UnmarshalJSON(data []byte) error { func (v *Config) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(&r, v) easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ContainerConfig) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *Config) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(l, v) easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(l, v)
} }
func easyjson1dbef17bDecodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(in *jlexer.Lexer, out *ocicni.PortMapping) { func easyjson1dbef17bDecodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(in *jlexer.Lexer, out *ocicni.PortMapping) {

@ -1043,12 +1043,12 @@ func (c *Container) addLocalVolumes(ctx context.Context, g *generate.Generator,
} }
// Add the built-in volumes of the container passed in to --volumes-from // Add the built-in volumes of the container passed in to --volumes-from
for _, vol := range c.config.LocalVolumes { for _, vol := range c.config.LocalVolumes {
if imageData.ContainerConfig.Volumes == nil { if imageData.Config.Volumes == nil {
imageData.ContainerConfig.Volumes = map[string]struct{}{ imageData.Config.Volumes = map[string]struct{}{
vol: {}, vol: {},
} }
} else { } else {
imageData.ContainerConfig.Volumes[vol] = struct{}{} imageData.Config.Volumes[vol] = struct{}{}
} }
} }
@ -1060,7 +1060,7 @@ func (c *Container) addLocalVolumes(ctx context.Context, g *generate.Generator,
gid = execUser.Gid gid = execUser.Gid
} }
for k := range imageData.ContainerConfig.Volumes { for k := range imageData.Config.Volumes {
mount := spec.Mount{ mount := spec.Mount{
Destination: k, Destination: k,
Type: "bind", Type: "bind",

@ -28,7 +28,7 @@ func TestPostDeleteHooks(t *testing.T) {
statePath := filepath.Join(dir, "state") statePath := filepath.Join(dir, "state")
copyPath := filepath.Join(dir, "copy") copyPath := filepath.Join(dir, "copy")
c := Container{ c := Container{
config: &ContainerConfig{ config: &Config{
ID: "123abc", ID: "123abc",
Spec: &rspec.Spec{ Spec: &rspec.Spec{
Annotations: map[string]string{ Annotations: map[string]string{

@ -832,21 +832,21 @@ func (i *Image) Inspect(ctx context.Context) (*inspect.ImageData, error) {
} }
data := &inspect.ImageData{ data := &inspect.ImageData{
ID: i.ID(), ID: i.ID(),
RepoTags: i.Names(), RepoTags: i.Names(),
RepoDigests: repoDigests, RepoDigests: repoDigests,
Comment: comment, Comment: comment,
Created: ociv1Img.Created, Created: ociv1Img.Created,
Author: ociv1Img.Author, Author: ociv1Img.Author,
Architecture: ociv1Img.Architecture, Architecture: ociv1Img.Architecture,
Os: ociv1Img.OS, Os: ociv1Img.OS,
ContainerConfig: &ociv1Img.Config, Config: &ociv1Img.Config,
Version: info.DockerVersion, Version: info.DockerVersion,
Size: int64(*size), Size: int64(*size),
VirtualSize: int64(*size), VirtualSize: int64(*size),
Annotations: annotations, Annotations: annotations,
Digest: i.Digest(), Digest: i.Digest(),
Labels: info.Labels, Labels: info.Labels,
RootFS: &inspect.RootFS{ RootFS: &inspect.RootFS{
Type: ociv1Img.RootFS.Type, Type: ociv1Img.RootFS.Type,
Layers: ociv1Img.RootFS.DiffIDs, Layers: ociv1Img.RootFS.DiffIDs,

@ -1056,7 +1056,7 @@ func WithUserVolumes(volumes []string) CtrCreateOption {
// WithLocalVolumes sets the built-in volumes of the container retrieved // WithLocalVolumes sets the built-in volumes of the container retrieved
// from a container passed in to the --volumes-from flag. // from a container passed in to the --volumes-from flag.
// This stores the built-in volume information in the ContainerConfig so we can // This stores the built-in volume information in the Config so we can
// add them when creating the container. // add them when creating the container.
func WithLocalVolumes(volumes []string) CtrCreateOption { func WithLocalVolumes(volumes []string) CtrCreateOption {
return func(ctr *Container) error { return func(ctr *Container) error {

@ -48,7 +48,7 @@ func (r *Runtime) newContainer(ctx context.Context, rSpec *spec.Spec, options ..
} }
ctr := new(Container) ctr := new(Container)
ctr.config = new(ContainerConfig) ctr.config = new(Config)
ctr.state = new(containerState) ctr.state = new(containerState)
ctr.config.ID = stringid.GenerateNonCryptoID() ctr.config.ID = stringid.GenerateNonCryptoID()

@ -152,7 +152,7 @@ func TestGetContainerPodSameIDFails(t *testing.T) {
func TestAddInvalidContainerFails(t *testing.T) { func TestAddInvalidContainerFails(t *testing.T) {
runForAllStates(t, func(t *testing.T, state State, lockPath string) { runForAllStates(t, func(t *testing.T, state State, lockPath string) {
err := state.AddContainer(&Container{config: &ContainerConfig{ID: "1234"}}) err := state.AddContainer(&Container{config: &Config{ID: "1234"}})
assert.Error(t, err) assert.Error(t, err)
}) })
} }
@ -752,7 +752,7 @@ func TestUpdateContainerNotInDatabaseReturnsError(t *testing.T) {
func TestUpdateInvalidContainerReturnsError(t *testing.T) { func TestUpdateInvalidContainerReturnsError(t *testing.T) {
runForAllStates(t, func(t *testing.T, state State, lockPath string) { runForAllStates(t, func(t *testing.T, state State, lockPath string) {
err := state.UpdateContainer(&Container{config: &ContainerConfig{ID: "1234"}}) err := state.UpdateContainer(&Container{config: &Config{ID: "1234"}})
assert.Error(t, err) assert.Error(t, err)
}) })
} }
@ -776,7 +776,7 @@ func TestUpdateContainerNotInNamespaceReturnsError(t *testing.T) {
func TestSaveInvalidContainerReturnsError(t *testing.T) { func TestSaveInvalidContainerReturnsError(t *testing.T) {
runForAllStates(t, func(t *testing.T, state State, lockPath string) { runForAllStates(t, func(t *testing.T, state State, lockPath string) {
err := state.SaveContainer(&Container{config: &ContainerConfig{ID: "1234"}}) err := state.SaveContainer(&Container{config: &Config{ID: "1234"}})
assert.Error(t, err) assert.Error(t, err)
}) })
} }
@ -2600,7 +2600,7 @@ func TestAddContainerToPodInvalidCtr(t *testing.T) {
err = state.AddPod(testPod) err = state.AddPod(testPod)
assert.NoError(t, err) assert.NoError(t, err)
err = state.AddContainerToPod(testPod, &Container{config: &ContainerConfig{ID: "1234"}}) err = state.AddContainerToPod(testPod, &Container{config: &Config{ID: "1234"}})
assert.Error(t, err) assert.Error(t, err)
ctrs, err := state.PodContainersByID(testPod) ctrs, err := state.PodContainersByID(testPod)

@ -106,27 +106,27 @@ type LogConfig struct {
// ImageData holds the inspect information of an image // ImageData holds the inspect information of an image
type ImageData struct { type ImageData struct {
ID string `json:"Id"` ID string `json:"Id"`
Digest digest.Digest `json:"Digest"` Digest digest.Digest `json:"Digest"`
RepoTags []string `json:"RepoTags"` RepoTags []string `json:"RepoTags"`
RepoDigests []string `json:"RepoDigests"` RepoDigests []string `json:"RepoDigests"`
Parent string `json:"Parent"` Parent string `json:"Parent"`
Comment string `json:"Comment"` Comment string `json:"Comment"`
Created *time.Time `json:"Created"` Created *time.Time `json:"Created"`
ContainerConfig *v1.ImageConfig `json:"ContainerConfig"` Config *v1.ImageConfig `json:"Config"`
Version string `json:"Version"` Version string `json:"Version"`
Author string `json:"Author"` Author string `json:"Author"`
Architecture string `json:"Architecture"` Architecture string `json:"Architecture"`
Os string `json:"Os"` Os string `json:"Os"`
Size int64 `json:"Size"` Size int64 `json:"Size"`
VirtualSize int64 `json:"VirtualSize"` VirtualSize int64 `json:"VirtualSize"`
GraphDriver *Data `json:"GraphDriver"` GraphDriver *Data `json:"GraphDriver"`
RootFS *RootFS `json:"RootFS"` RootFS *RootFS `json:"RootFS"`
Labels map[string]string `json:"Labels"` Labels map[string]string `json:"Labels"`
Annotations map[string]string `json:"Annotations"` Annotations map[string]string `json:"Annotations"`
ManifestType string `json:"ManifestType"` ManifestType string `json:"ManifestType"`
User string `json:"User"` User string `json:"User"`
History []v1.History `json:"History"` History []v1.History `json:"History"`
} }
// RootFS holds the root fs information of an image // RootFS holds the root fs information of an image

@ -82,7 +82,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
// ENTRYPOINT // ENTRYPOINT
// User input entrypoint takes priority over image entrypoint // User input entrypoint takes priority over image entrypoint
if len(entrypoint) == 0 { if len(entrypoint) == 0 {
entrypoint = data.ContainerConfig.Entrypoint entrypoint = data.Config.Entrypoint
} }
// if entrypoint=, we need to clear the entrypoint // if entrypoint=, we need to clear the entrypoint
if len(entrypoint) == 1 && strings.Join(create.Entrypoint, "") == "" { if len(entrypoint) == 1 && strings.Join(create.Entrypoint, "") == "" {
@ -96,9 +96,9 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
if len(inputCommand) > 0 { if len(inputCommand) > 0 {
// User command overrides data CMD // User command overrides data CMD
command = append(command, inputCommand...) command = append(command, inputCommand...)
} else if len(data.ContainerConfig.Cmd) > 0 && len(command) == 0 { } else if len(data.Config.Cmd) > 0 && len(command) == 0 {
// If not user command, add CMD // If not user command, add CMD
command = append(command, data.ContainerConfig.Cmd...) command = append(command, data.Config.Cmd...)
} }
if create.Resources.Blkio_weight != 0 { if create.Resources.Blkio_weight != 0 {
@ -115,11 +115,11 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
user := create.User user := create.User
if user == "" { if user == "" {
user = data.ContainerConfig.User user = data.Config.User
} }
// EXPOSED PORTS // EXPOSED PORTS
portBindings, err := cc.ExposedPorts(create.Exposed_ports, create.Publish, create.Publish_all, data.ContainerConfig.ExposedPorts) portBindings, err := cc.ExposedPorts(create.Exposed_ports, create.Publish, create.Publish_all, data.Config.ExposedPorts)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -143,7 +143,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
imageID := data.ID imageID := data.ID
config := &cc.CreateConfig{ config := &cc.CreateConfig{
Runtime: runtime, Runtime: runtime,
BuiltinImgVolumes: data.ContainerConfig.Volumes, BuiltinImgVolumes: data.Config.Volumes,
ConmonPidFile: create.Conmon_pidfile, ConmonPidFile: create.Conmon_pidfile,
ImageVolumeType: create.Image_volume_type, ImageVolumeType: create.Image_volume_type,
CapAdd: create.Cap_add, CapAdd: create.Cap_add,

@ -128,7 +128,7 @@ var _ = Describe("Podman commit", func() {
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect.ExitCode()).To(Equal(0)) Expect(inspect.ExitCode()).To(Equal(0))
image := inspect.InspectImageJSON() image := inspect.InspectImageJSON()
_, ok := image[0].ContainerConfig.Volumes["/tmp"] _, ok := image[0].Config.Volumes["/tmp"]
Expect(ok).To(BeTrue()) Expect(ok).To(BeTrue())
r := podmanTest.Podman([]string{"run", "newimage"}) r := podmanTest.Podman([]string{"run", "newimage"})

@ -106,7 +106,7 @@ var _ = Describe("Podman import", func() {
results.WaitWithDefaultTimeout() results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0)) Expect(results.ExitCode()).To(Equal(0))
imageData := results.InspectImageJSON() imageData := results.InspectImageJSON()
Expect(imageData[0].ContainerConfig.Cmd[0]).To(Equal("/bin/bash")) Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/bash"))
}) })
}) })