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/runtime.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/runtime.go')
-rw-r--r-- | libpod/runtime.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index b3b75d791..a4fc9e493 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -23,7 +23,6 @@ import ( "github.com/docker/docker/pkg/namesgenerator" "github.com/pkg/errors" "github.com/sirupsen/logrus" - "github.com/ulule/deepcopier" ) // RuntimeStateStore is a constant indicating which state store implementation @@ -355,7 +354,9 @@ func newRuntimeFromConfig(userConfigPath string, options ...RuntimeOption) (runt if err != nil { return nil, err } - deepcopier.Copy(defaultRuntimeConfig).To(runtime.config) + if err := JSONDeepCopy(defaultRuntimeConfig, runtime.config); err != nil { + return nil, errors.Wrapf(err, "error copying runtime default config") + } runtime.config.TmpDir = tmpDir storageConf, err := util.GetDefaultStoreOptions() @@ -923,20 +924,22 @@ func makeRuntime(runtime *Runtime) (err error) { } // GetConfig returns a copy of the configuration used by the runtime -func (r *Runtime) GetConfig() *RuntimeConfig { +func (r *Runtime) GetConfig() (*RuntimeConfig, error) { r.lock.RLock() defer r.lock.RUnlock() if !r.valid { - return nil + return nil, ErrRuntimeStopped } config := new(RuntimeConfig) // Copy so the caller won't be able to modify the actual config - deepcopier.Copy(r.config).To(config) + if err := JSONDeepCopy(r.config, config); err != nil { + return nil, errors.Wrapf(err, "error copying config") + } - return config + return config, nil } // Shutdown shuts down the runtime and associated containers and storage |