diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-28 07:06:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-28 07:06:31 -0700 |
commit | e7a2eecf5f3975edfb92cd2cacff0d34ef45f808 (patch) | |
tree | 5557aaeb6ec27d61b75b1db18dc5e0a4d85c90be /libpod/container.go | |
parent | 850326cc192444d1c5cfd8ba6e1015f653b41e73 (diff) | |
parent | 179a66f1a0a22be66c0346afa8ea3181d5846fb2 (diff) | |
download | podman-e7a2eecf5f3975edfb92cd2cacff0d34ef45f808.tar.gz podman-e7a2eecf5f3975edfb92cd2cacff0d34ef45f808.tar.bz2 podman-e7a2eecf5f3975edfb92cd2cacff0d34ef45f808.zip |
Merge pull request #2760 from mheon/misc_small_changes
Remove ulele/deepcopier in favor of JSON deep copy
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libpod/container.go b/libpod/container.go index 806e75c63..6d80a9bf4 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -17,7 +17,6 @@ import ( "github.com/cri-o/ocicni/pkg/ocicni" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" - "github.com/ulule/deepcopier" ) // ContainerStatus represents the current state of a container @@ -407,7 +406,9 @@ func (t ContainerStatus) String() string { // Config returns the configuration used to create the container func (c *Container) Config() *ContainerConfig { returnConfig := new(ContainerConfig) - deepcopier.Copy(c.config).To(returnConfig) + if err := JSONDeepCopy(c.config, returnConfig); err != nil { + return nil + } return returnConfig } @@ -417,7 +418,9 @@ func (c *Container) Config() *ContainerConfig { // spec may differ slightly as mounts are added based on the image func (c *Container) Spec() *spec.Spec { returnSpec := new(spec.Spec) - deepcopier.Copy(c.config.Spec).To(returnSpec) + if err := JSONDeepCopy(c.config.Spec, returnSpec); err != nil { + return nil + } return returnSpec } @@ -1094,7 +1097,9 @@ func (c *Container) ContainerState() (*ContainerState, error) { } } returnConfig := new(ContainerState) - deepcopier.Copy(c.state).To(returnConfig) + if err := JSONDeepCopy(c.state, returnConfig); err != nil { + return nil, errors.Wrapf(err, "error copying container %s state", c.ID()) + } return c.state, nil } |