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 /libpod | |
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
Diffstat (limited to 'libpod')
-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 |
10 files changed, 44 insertions, 44 deletions
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) |