aboutsummaryrefslogtreecommitdiff
path: root/libpod/boltdb_state.go
diff options
context:
space:
mode:
authorMarco Vedovati <mvedovati@suse.com>2019-07-03 11:53:29 +0200
committerMarco Vedovati <mvedovati@suse.com>2019-07-03 11:57:45 +0200
commit64a91b09ae76000fe89ec165a0049b3dc3759617 (patch)
treea573303934d56e5f742c72bc93caa1dda1f33ae6 /libpod/boltdb_state.go
parent23711589f06b243fde07b9fcecb1cdc11c98a616 (diff)
downloadpodman-64a91b09ae76000fe89ec165a0049b3dc3759617.tar.gz
podman-64a91b09ae76000fe89ec165a0049b3dc3759617.tar.bz2
podman-64a91b09ae76000fe89ec165a0049b3dc3759617.zip
libpod: discerne partial IDs between containers and pods
When specifying a podman command with a partial ID, container and pod commands matches respectively only containers or pods IDs in the BoltDB. Fixes: #3487 Signed-off-by: Marco Vedovati <mvedovati@suse.com>
Diffstat (limited to 'libpod/boltdb_state.go')
-rw-r--r--libpod/boltdb_state.go14
1 files changed, 2 insertions, 12 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go
index b047c9fa0..4dda3a7f0 100644
--- a/libpod/boltdb_state.go
+++ b/libpod/boltdb_state.go
@@ -381,11 +381,6 @@ func (s *BoltState) LookupContainer(idOrName string) (*Container, error) {
defer s.closeDBCon(db)
err = db.View(func(tx *bolt.Tx) error {
- idBucket, err := getIDBucket(tx)
- if err != nil {
- return err
- }
-
ctrBucket, err := getCtrBucket(tx)
if err != nil {
return err
@@ -436,7 +431,7 @@ func (s *BoltState) LookupContainer(idOrName string) (*Container, error) {
// We were not given a full container ID or name.
// Search for partial ID matches.
exists := false
- err = idBucket.ForEach(func(checkID, checkName []byte) error {
+ err = ctrBucket.ForEach(func(checkID, checkName []byte) error {
// If the container isn't in our namespace, we
// can't match it
if s.namespaceBytes != nil {
@@ -963,11 +958,6 @@ func (s *BoltState) LookupPod(idOrName string) (*Pod, error) {
defer s.closeDBCon(db)
err = db.View(func(tx *bolt.Tx) error {
- idBucket, err := getIDBucket(tx)
- if err != nil {
- return err
- }
-
podBkt, err := getPodBucket(tx)
if err != nil {
return err
@@ -1015,7 +1005,7 @@ func (s *BoltState) LookupPod(idOrName string) (*Pod, error) {
// They did not give us a full pod name or ID.
// Search for partial ID matches.
exists := false
- err = idBucket.ForEach(func(checkID, checkName []byte) error {
+ err = podBkt.ForEach(func(checkID, checkName []byte) error {
// If the pod isn't in our namespace, we
// can't match it
if s.namespaceBytes != nil {