diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-12-22 03:11:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-22 03:11:08 -0800 |
commit | 792f10988ed2badcce9a11a880303614412b9a00 (patch) | |
tree | 96386ffcf059e1f5464db09e374e0cdc8a021430 | |
parent | 7122b49464519252a4f91ce1df337150ca24be42 (diff) | |
parent | c657dc4fdbca4b331d69e0910261e2cb11e2a629 (diff) | |
download | podman-792f10988ed2badcce9a11a880303614412b9a00.tar.gz podman-792f10988ed2badcce9a11a880303614412b9a00.tar.bz2 podman-792f10988ed2badcce9a11a880303614412b9a00.zip |
Merge pull request #2023 from rhatdan/config
Switch all references to image.ContainerConfig to image.Config
-rw-r--r-- | cmd/podman/create.go | 22 | ||||
-rw-r--r-- | cmd/podman/docker/types.go | 10 | ||||
-rw-r--r-- | cmd/podman/run_test.go | 18 | ||||
-rw-r--r-- | cmd/podman/shared/container.go | 4 | ||||
-rw-r--r-- | contrib/python/podman/podman/libs/images.py | 4 | ||||
-rw-r--r-- | contrib/python/podman/test/test_containers.py | 18 | ||||
-rw-r--r-- | contrib/python/podman/test/test_images.py | 2 | ||||
-rw-r--r-- | docs/podman-inspect.1.md | 2 | ||||
-rw-r--r-- | libpod/boltdb_state.go | 8 | ||||
-rw-r--r-- | libpod/common_test.go | 6 | ||||
-rw-r--r-- | libpod/container.go | 10 | ||||
-rw-r--r-- | libpod/container_easyjson.go | 12 | ||||
-rw-r--r-- | libpod/container_internal.go | 8 | ||||
-rw-r--r-- | libpod/container_internal_test.go | 2 | ||||
-rw-r--r-- | libpod/image/image.go | 30 | ||||
-rw-r--r-- | libpod/options.go | 2 | ||||
-rw-r--r-- | libpod/runtime_ctr.go | 2 | ||||
-rw-r--r-- | libpod/state_test.go | 8 | ||||
-rw-r--r-- | pkg/inspect/inspect.go | 42 | ||||
-rw-r--r-- | pkg/varlinkapi/containers_create.go | 12 | ||||
-rw-r--r-- | test/e2e/commit_test.go | 2 | ||||
-rw-r--r-- | test/e2e/import_test.go | 2 |
22 files changed, 113 insertions, 113 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 1425892cc..dae429047 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -344,7 +344,7 @@ func configureEntrypoint(c *cli.Context, data *inspect.ImageData) []string { return []string{c.String("entrypoint")} } if data != nil { - return data.ContainerConfig.Entrypoint + return data.Config.Entrypoint } return entrypoint } @@ -474,7 +474,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim // EXPOSED PORTS var portBindings map[nat.Port][]nat.PortBinding 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 { return nil, err } @@ -567,7 +567,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim if data == nil { user = "0" } 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 signalString := "" if data != nil { - signalString = data.ContainerConfig.StopSignal + signalString = data.Config.StopSignal } if c.IsSet("stop-signal") { signalString = c.String("stop-signal") @@ -590,7 +590,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim // ENVIRONMENT VARIABLES env := defaultEnvVariables if data != nil { - for _, e := range data.ContainerConfig.Env { + for _, e := range data.Config.Env { split := strings.SplitN(e, "=", 2) if len(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") } if data != nil { - for key, val := range data.ContainerConfig.Labels { + for key, val := range data.Config.Labels { if _, ok := labels[key]; !ok { labels[key] = val } @@ -643,8 +643,8 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim workDir := "/" if c.IsSet("workdir") || c.IsSet("w") { workDir = c.String("workdir") - } else if data != nil && data.ContainerConfig.WorkingDir != "" { - workDir = data.ContainerConfig.WorkingDir + } else if data != nil && data.Config.WorkingDir != "" { + workDir = data.Config.WorkingDir } entrypoint := configureEntrypoint(c, data) @@ -656,9 +656,9 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim if len(inputCommand) > 0 { // User command overrides data CMD 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 - command = append(command, data.ContainerConfig.Cmd...) + command = append(command, data.Config.Cmd...) } 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{} if data != nil { - ImageVolumes = data.ContainerConfig.Volumes + ImageVolumes = data.Config.Volumes } var imageVolType = map[string]string{ "bind": "", diff --git a/cmd/podman/docker/types.go b/cmd/podman/docker/types.go index a7e456554..90349a31c 100644 --- a/cmd/podman/docker/types.go +++ b/cmd/podman/docker/types.go @@ -125,11 +125,11 @@ type Config struct { // don't result in runnable images on their own. // github.com/docker/distribution/manifest/schema1/config_builder.go type V1Compatibility struct { - ID string `json:"id"` - Parent string `json:"parent,omitempty"` - Comment string `json:"comment,omitempty"` - Created time.Time `json:"created"` - ContainerConfig struct { + ID string `json:"id"` + Parent string `json:"parent,omitempty"` + Comment string `json:"comment,omitempty"` + Created time.Time `json:"created"` + Config struct { Cmd []string } `json:"container_config,omitempty"` Author string `json:"author,omitempty"` diff --git a/cmd/podman/run_test.go b/cmd/podman/run_test.go index 079e570aa..33c0a4bfe 100644 --- a/cmd/podman/run_test.go +++ b/cmd/podman/run_test.go @@ -39,15 +39,15 @@ func generateAlpineImageData() *inspect.ImageData { } data := &inspect.ImageData{ - ID: "e21c333399e0aeedfd70e8827c9fba3f8e9b170ef8a48a29945eb7702bf6aa5f", - RepoTags: []string{"docker.io/library/alpine:latest"}, - RepoDigests: []string{"docker.io/library/alpine@sha256:5cb04fce748f576d7b72a37850641de8bd725365519673c643ef2d14819b42c6"}, - Comment: "Created:2017-12-01 18:48:48.949613376 +0000", - Author: "", - Architecture: "amd64", - Os: "linux", - Version: "17.06.2-ce", - ContainerConfig: config, + ID: "e21c333399e0aeedfd70e8827c9fba3f8e9b170ef8a48a29945eb7702bf6aa5f", + RepoTags: []string{"docker.io/library/alpine:latest"}, + RepoDigests: []string{"docker.io/library/alpine@sha256:5cb04fce748f576d7b72a37850641de8bd725365519673c643ef2d14819b42c6"}, + Comment: "Created:2017-12-01 18:48:48.949613376 +0000", + Author: "", + Architecture: "amd64", + Os: "linux", + Version: "17.06.2-ce", + Config: config, } return data } diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index 6236d19b4..30beb4a49 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -51,7 +51,7 @@ type PsOptions struct { // BatchContainerStruct is the return obkect from BatchContainer and contains // container related information type BatchContainerStruct struct { - ConConfig *libpod.ContainerConfig + ConConfig *libpod.Config ConState libpod.ContainerStatus ExitCode int32 Exited bool @@ -328,7 +328,7 @@ func PBatch(containers []*libpod.Container, workers int, opts PsOptions) []PsCon // locks. func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStruct, error) { var ( - conConfig *libpod.ContainerConfig + conConfig *libpod.Config conState libpod.ContainerStatus err error exitCode int32 diff --git a/contrib/python/podman/podman/libs/images.py b/contrib/python/podman/podman/libs/images.py index ae1b86390..29ebe2c0f 100644 --- a/contrib/python/podman/podman/libs/images.py +++ b/contrib/python/podman/podman/libs/images.py @@ -41,8 +41,8 @@ class Image(collections.UserDict): details = self.inspect() config = ConfigDict(image_id=self._id, **kwargs) - config['command'] = details.containerconfig.get('cmd') - config['env'] = self._split_token(details.containerconfig.get('env')) + config['command'] = details.config.get('cmd') + config['env'] = self._split_token(details.config.get('env')) config['image'] = copy.deepcopy(details.repotags[0]) config['labels'] = copy.deepcopy(details.labels) config['net_mode'] = 'bridge' diff --git a/contrib/python/podman/test/test_containers.py b/contrib/python/podman/test/test_containers.py index a7a6ac304..5201956e8 100644 --- a/contrib/python/podman/test/test_containers.py +++ b/contrib/python/podman/test/test_containers.py @@ -140,7 +140,7 @@ class TestContainers(PodmanTestCase): # TODO: Test for STOPSIGNAL when supported by OCI # TODO: Test for message when supported by OCI 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('ENTRYPOINT=/bin/sh date') changes.append('ENV=TEST=test_containers.TestContainers.test_commit') @@ -158,22 +158,22 @@ class TestContainers(PodmanTestCase): details = img.inspect() 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'], - details.containerconfig['entrypoint']) + details.config['entrypoint']) self.assertIn('TEST=test_containers.TestContainers.test_commit', - details.containerconfig['env']) + details.config['env']) 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({ '80': {}, '8888': {}, - }, details.containerconfig['exposedports']) + }, details.config['exposedports']) self.assertDictEqual({'unittest': 'test_commit'}, details.labels) - self.assertEqual('bozo:circus', details.containerconfig['user']) - self.assertEqual({'/data': {}}, details.containerconfig['volumes']) + self.assertEqual('bozo:circus', details.config['user']) + self.assertEqual({'/data': {}}, details.config['volumes']) self.assertEqual('/data/application', - details.containerconfig['workingdir']) + details.config['workingdir']) def test_remove(self): before = len(self.containers) diff --git a/contrib/python/podman/test/test_images.py b/contrib/python/podman/test/test_images.py index 45f0a2964..af6d4741e 100644 --- a/contrib/python/podman/test/test_images.py +++ b/contrib/python/podman/test/test_images.py @@ -69,7 +69,7 @@ class TestImages(PodmanTestCase): self.assertEqual(FoldedString(ctnr.status), 'running') 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']) def test_export(self): diff --git a/docs/podman-inspect.1.md b/docs/podman-inspect.1.md index 17fb2df60..7bdbcc662 100644 --- a/docs/podman-inspect.1.md +++ b/docs/podman-inspect.1.md @@ -48,7 +48,7 @@ Display the total file size if the type is a container "Parent": "", "Comment": "", "Created": "2017-11-14T21:07:08.475840838Z", - "ContainerConfig": { + "Config": { "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "DISTTAG=f27container", diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go index b154d8bda..ba8f7375a 100644 --- a/libpod/boltdb_state.go +++ b/libpod/boltdb_state.go @@ -322,7 +322,7 @@ func (s *BoltState) Container(id string) (*Container, error) { ctrID := []byte(id) ctr := new(Container) - ctr.config = new(ContainerConfig) + ctr.config = new(Config) ctr.state = new(containerState) db, err := s.getDBCon() @@ -358,7 +358,7 @@ func (s *BoltState) LookupContainer(idOrName string) (*Container, error) { } ctr := new(Container) - ctr.config = new(ContainerConfig) + ctr.config = new(Config) ctr.state = new(containerState) db, err := s.getDBCon() @@ -751,7 +751,7 @@ func (s *BoltState) AllContainers() ([]*Container, error) { } ctr := new(Container) - ctr.config = new(ContainerConfig) + ctr.config = new(Config) ctr.state = new(containerState) 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 err = podCtrs.ForEach(func(id, val []byte) error { newCtr := new(Container) - newCtr.config = new(ContainerConfig) + newCtr.config = new(Config) newCtr.state = new(containerState) ctrs = append(ctrs, newCtr) diff --git a/libpod/common_test.go b/libpod/common_test.go index 81c8f1920..6c7434fd2 100644 --- a/libpod/common_test.go +++ b/libpod/common_test.go @@ -18,7 +18,7 @@ import ( func getTestContainer(id, name, locksDir string) (*Container, error) { ctr := &Container{ - config: &ContainerConfig{ + config: &Config{ ID: id, Name: name, RootfsImageID: id, @@ -165,8 +165,8 @@ func testContainersEqual(t *testing.T, a, b *Container, allowedEmpty bool) { require.NotNil(t, a.state) require.NotNil(t, b.state) - aConfig := new(ContainerConfig) - bConfig := new(ContainerConfig) + aConfig := new(Config) + bConfig := new(Config) aState := new(containerState) bState := new(containerState) diff --git a/libpod/container.go b/libpod/container.go index 18d867f41..b4190344a 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -112,7 +112,7 @@ func (ns LinuxNS) String() string { // syncContainer() immediately after locking. // ffjson: skip type Container struct { - config *ContainerConfig + config *Config state *containerState @@ -199,11 +199,11 @@ type ExecSession struct { 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. // It is stored, read-only, on disk // easyjson:json -type ContainerConfig struct { +type Config struct { Spec *spec.Spec `json:"spec"` ID string `json:"id"` Name string `json:"name"` @@ -382,8 +382,8 @@ func (t ContainerStatus) String() string { // Unlocked // Config returns the configuration used to create the container -func (c *Container) Config() *ContainerConfig { - returnConfig := new(ContainerConfig) +func (c *Container) Config() *Config { + returnConfig := new(Config) deepcopier.Copy(c.config).To(returnConfig) return returnConfig diff --git a/libpod/container_easyjson.go b/libpod/container_easyjson.go index 8bf5cb64f..299a645e1 100644 --- a/libpod/container_easyjson.go +++ b/libpod/container_easyjson.go @@ -1238,7 +1238,7 @@ func (v *ExecSession) UnmarshalJSON(data []byte) error { func (v *ExecSession) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson1dbef17bDecodeGithubComContainersLibpodLibpod1(l, v) } -func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *ContainerConfig) { +func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *Config) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1720,7 +1720,7 @@ func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, ou in.Consumed() } } -func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in ContainerConfig) { +func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in Config) { out.RawByte('{') first := true _ = first @@ -2415,26 +2415,26 @@ func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, } // MarshalJSON supports json.Marshaler interface -func (v ContainerConfig) MarshalJSON() ([]byte, error) { +func (v Config) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v ContainerConfig) MarshalEasyJSON(w *jwriter.Writer) { +func (v Config) MarshalEasyJSON(w *jwriter.Writer) { easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *ContainerConfig) UnmarshalJSON(data []byte) error { +func (v *Config) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *ContainerConfig) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *Config) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(l, v) } func easyjson1dbef17bDecodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(in *jlexer.Lexer, out *ocicni.PortMapping) { diff --git a/libpod/container_internal.go b/libpod/container_internal.go index af17d8495..3217b2421 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -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 for _, vol := range c.config.LocalVolumes { - if imageData.ContainerConfig.Volumes == nil { - imageData.ContainerConfig.Volumes = map[string]struct{}{ + if imageData.Config.Volumes == nil { + imageData.Config.Volumes = map[string]struct{}{ vol: {}, } } 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 } - for k := range imageData.ContainerConfig.Volumes { + for k := range imageData.Config.Volumes { mount := spec.Mount{ Destination: k, Type: "bind", diff --git a/libpod/container_internal_test.go b/libpod/container_internal_test.go index 124f1d20e..51fb58713 100644 --- a/libpod/container_internal_test.go +++ b/libpod/container_internal_test.go @@ -28,7 +28,7 @@ func TestPostDeleteHooks(t *testing.T) { statePath := filepath.Join(dir, "state") copyPath := filepath.Join(dir, "copy") c := Container{ - config: &ContainerConfig{ + config: &Config{ ID: "123abc", Spec: &rspec.Spec{ Annotations: map[string]string{ diff --git a/libpod/image/image.go b/libpod/image/image.go index 476d28226..3a6d0e305 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -832,21 +832,21 @@ func (i *Image) Inspect(ctx context.Context) (*inspect.ImageData, error) { } data := &inspect.ImageData{ - ID: i.ID(), - RepoTags: i.Names(), - RepoDigests: repoDigests, - Comment: comment, - Created: ociv1Img.Created, - Author: ociv1Img.Author, - Architecture: ociv1Img.Architecture, - Os: ociv1Img.OS, - ContainerConfig: &ociv1Img.Config, - Version: info.DockerVersion, - Size: int64(*size), - VirtualSize: int64(*size), - Annotations: annotations, - Digest: i.Digest(), - Labels: info.Labels, + ID: i.ID(), + RepoTags: i.Names(), + RepoDigests: repoDigests, + Comment: comment, + Created: ociv1Img.Created, + Author: ociv1Img.Author, + Architecture: ociv1Img.Architecture, + Os: ociv1Img.OS, + Config: &ociv1Img.Config, + Version: info.DockerVersion, + Size: int64(*size), + VirtualSize: int64(*size), + Annotations: annotations, + Digest: i.Digest(), + Labels: info.Labels, RootFS: &inspect.RootFS{ Type: ociv1Img.RootFS.Type, Layers: ociv1Img.RootFS.DiffIDs, diff --git a/libpod/options.go b/libpod/options.go index 9aa657ddd..319e1f6c6 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1056,7 +1056,7 @@ func WithUserVolumes(volumes []string) CtrCreateOption { // WithLocalVolumes sets the built-in volumes of the container retrieved // 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. func WithLocalVolumes(volumes []string) CtrCreateOption { return func(ctr *Container) error { diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index c108febd7..c448f8cb1 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -48,7 +48,7 @@ func (r *Runtime) newContainer(ctx context.Context, rSpec *spec.Spec, options .. } ctr := new(Container) - ctr.config = new(ContainerConfig) + ctr.config = new(Config) ctr.state = new(containerState) ctr.config.ID = stringid.GenerateNonCryptoID() diff --git a/libpod/state_test.go b/libpod/state_test.go index d93a371f3..708ce7d4e 100644 --- a/libpod/state_test.go +++ b/libpod/state_test.go @@ -152,7 +152,7 @@ func TestGetContainerPodSameIDFails(t *testing.T) { func TestAddInvalidContainerFails(t *testing.T) { 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) }) } @@ -752,7 +752,7 @@ func TestUpdateContainerNotInDatabaseReturnsError(t *testing.T) { func TestUpdateInvalidContainerReturnsError(t *testing.T) { 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) }) } @@ -776,7 +776,7 @@ func TestUpdateContainerNotInNamespaceReturnsError(t *testing.T) { func TestSaveInvalidContainerReturnsError(t *testing.T) { 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) }) } @@ -2600,7 +2600,7 @@ func TestAddContainerToPodInvalidCtr(t *testing.T) { err = state.AddPod(testPod) 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) ctrs, err := state.PodContainersByID(testPod) diff --git a/pkg/inspect/inspect.go b/pkg/inspect/inspect.go index 5bdcf677f..dcb7738be 100644 --- a/pkg/inspect/inspect.go +++ b/pkg/inspect/inspect.go @@ -106,27 +106,27 @@ type LogConfig struct { // ImageData holds the inspect information of an image type ImageData struct { - ID string `json:"Id"` - Digest digest.Digest `json:"Digest"` - RepoTags []string `json:"RepoTags"` - RepoDigests []string `json:"RepoDigests"` - Parent string `json:"Parent"` - Comment string `json:"Comment"` - Created *time.Time `json:"Created"` - ContainerConfig *v1.ImageConfig `json:"ContainerConfig"` - Version string `json:"Version"` - Author string `json:"Author"` - Architecture string `json:"Architecture"` - Os string `json:"Os"` - Size int64 `json:"Size"` - VirtualSize int64 `json:"VirtualSize"` - GraphDriver *Data `json:"GraphDriver"` - RootFS *RootFS `json:"RootFS"` - Labels map[string]string `json:"Labels"` - Annotations map[string]string `json:"Annotations"` - ManifestType string `json:"ManifestType"` - User string `json:"User"` - History []v1.History `json:"History"` + ID string `json:"Id"` + Digest digest.Digest `json:"Digest"` + RepoTags []string `json:"RepoTags"` + RepoDigests []string `json:"RepoDigests"` + Parent string `json:"Parent"` + Comment string `json:"Comment"` + Created *time.Time `json:"Created"` + Config *v1.ImageConfig `json:"Config"` + Version string `json:"Version"` + Author string `json:"Author"` + Architecture string `json:"Architecture"` + Os string `json:"Os"` + Size int64 `json:"Size"` + VirtualSize int64 `json:"VirtualSize"` + GraphDriver *Data `json:"GraphDriver"` + RootFS *RootFS `json:"RootFS"` + Labels map[string]string `json:"Labels"` + Annotations map[string]string `json:"Annotations"` + ManifestType string `json:"ManifestType"` + User string `json:"User"` + History []v1.History `json:"History"` } // RootFS holds the root fs information of an image diff --git a/pkg/varlinkapi/containers_create.go b/pkg/varlinkapi/containers_create.go index bb6273fd1..63bc93686 100644 --- a/pkg/varlinkapi/containers_create.go +++ b/pkg/varlinkapi/containers_create.go @@ -82,7 +82,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru // ENTRYPOINT // User input entrypoint takes priority over image entrypoint if len(entrypoint) == 0 { - entrypoint = data.ContainerConfig.Entrypoint + entrypoint = data.Config.Entrypoint } // if entrypoint=, we need to clear the 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 { // User command overrides data CMD 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 - command = append(command, data.ContainerConfig.Cmd...) + command = append(command, data.Config.Cmd...) } if create.Resources.Blkio_weight != 0 { @@ -115,11 +115,11 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru user := create.User if user == "" { - user = data.ContainerConfig.User + user = data.Config.User } // 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 { return nil, err } @@ -143,7 +143,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru imageID := data.ID config := &cc.CreateConfig{ Runtime: runtime, - BuiltinImgVolumes: data.ContainerConfig.Volumes, + BuiltinImgVolumes: data.Config.Volumes, ConmonPidFile: create.Conmon_pidfile, ImageVolumeType: create.Image_volume_type, CapAdd: create.Cap_add, diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go index 4ee5061f0..18771c09e 100644 --- a/test/e2e/commit_test.go +++ b/test/e2e/commit_test.go @@ -128,7 +128,7 @@ var _ = Describe("Podman commit", func() { inspect.WaitWithDefaultTimeout() Expect(inspect.ExitCode()).To(Equal(0)) image := inspect.InspectImageJSON() - _, ok := image[0].ContainerConfig.Volumes["/tmp"] + _, ok := image[0].Config.Volumes["/tmp"] Expect(ok).To(BeTrue()) r := podmanTest.Podman([]string{"run", "newimage"}) diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go index 9ed4593c6..6f132fd93 100644 --- a/test/e2e/import_test.go +++ b/test/e2e/import_test.go @@ -106,7 +106,7 @@ var _ = Describe("Podman import", func() { results.WaitWithDefaultTimeout() Expect(results.ExitCode()).To(Equal(0)) imageData := results.InspectImageJSON() - Expect(imageData[0].ContainerConfig.Cmd[0]).To(Equal("/bin/bash")) + Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/bash")) }) }) |