diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-17 23:18:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 23:18:48 +0100 |
commit | 8a0c3d878b13d86b97da188bda1fe580dbb07b8f (patch) | |
tree | d7fa4be266bd8a79008c45c8f357a856eb107003 /libpod/boltdb_state.go | |
parent | 0f745272e79daa496e541ff18bc6e21339559f38 (diff) | |
parent | d3e794bda39167b15c5dc14d83333d1306316b11 (diff) | |
download | podman-8a0c3d878b13d86b97da188bda1fe580dbb07b8f.tar.gz podman-8a0c3d878b13d86b97da188bda1fe580dbb07b8f.tar.bz2 podman-8a0c3d878b13d86b97da188bda1fe580dbb07b8f.zip |
Merge pull request #8355 from baude/compatnetworkconnectdisconnect
add network connect|disconnect compat endpoints
Diffstat (limited to 'libpod/boltdb_state.go')
-rw-r--r-- | libpod/boltdb_state.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go index be0adfe6a..dcb2ff751 100644 --- a/libpod/boltdb_state.go +++ b/libpod/boltdb_state.go @@ -1296,10 +1296,6 @@ func (s *BoltState) NetworkDisconnect(ctr *Container, network string) error { } ctrAliasesBkt := dbCtr.Bucket(aliasesBkt) - if ctrAliasesBkt == nil { - return errors.Wrapf(define.ErrNoAliases, "container %s has no network aliases", ctr.ID()) - } - ctrNetworksBkt := dbCtr.Bucket(networksBkt) if ctrNetworksBkt == nil { return errors.Wrapf(define.ErrNoSuchNetwork, "container %s is not connected to any CNI networks, so cannot disconnect", ctr.ID()) @@ -1313,13 +1309,15 @@ func (s *BoltState) NetworkDisconnect(ctr *Container, network string) error { return errors.Wrapf(err, "error removing container %s from network %s", ctr.ID(), network) } - bktExists := ctrAliasesBkt.Bucket([]byte(network)) - if bktExists == nil { - return nil - } + if ctrAliasesBkt != nil { + bktExists := ctrAliasesBkt.Bucket([]byte(network)) + if bktExists == nil { + return nil + } - if err := ctrAliasesBkt.DeleteBucket([]byte(network)); err != nil { - return errors.Wrapf(err, "error removing container %s network aliases for network %s", ctr.ID(), network) + if err := ctrAliasesBkt.DeleteBucket([]byte(network)); err != nil { + return errors.Wrapf(err, "error removing container %s network aliases for network %s", ctr.ID(), network) + } } return nil |