diff options
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r-- | libpod/boltdb_state_internal.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go index 25dd216a3..29ed42f1e 100644 --- a/libpod/boltdb_state_internal.go +++ b/libpod/boltdb_state_internal.go @@ -256,13 +256,22 @@ func (s *BoltState) getPodFromDB(id []byte, pod *Pod, podBkt *bolt.Bucket) error return errors.Wrapf(ErrNoSuchPod, "pod with ID %s not found", string(id)) } - podBytes := podDB.Get(configKey) - if podBytes == nil { + podConfigBytes := podDB.Get(configKey) + if podConfigBytes == nil { return errors.Wrapf(ErrInternal, "pod %s is missing configuration key in DB", string(id)) } - if err := json.Unmarshal(podBytes, pod.config); err != nil { - return errors.Wrapf(err, "error unmarshalling pod %s from DB", string(id)) + if err := json.Unmarshal(podConfigBytes, pod.config); err != nil { + return errors.Wrapf(err, "error unmarshalling pod %s config from DB", string(id)) + } + + podStateBytes := podDB.Get(stateKey) + if podStateBytes == nil { + return errors.Wrapf(ErrInternal, "pod %s is missing state key in DB", string(id)) + } + + if err := json.Unmarshal(podStateBytes, pod.state); err != nil { + return errors.Wrapf(err, "error unmarshalling pod %s state from DB", string(id)) } // Get the lock |