From a5fb2b4b11e583fcceeb7ca47af86e83e163cd18 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 24 Oct 2017 18:40:50 -0400 Subject: [PATCH] libpod: set the default Store to match a Runtime When initializing a Runtime, set the default Store for the containers-storage transport in the image library to the same one that we're using, so that the calling process sees the same set of images in the Runtime that it sees when going through the image library. Update the kpod_push test so that it no longer has to specify a location in the destination image reference, since the default should already be passed to kpod as global options. Signed-off-by: Nalin Dahyabhai --- libpod/runtime.go | 2 ++ test/kpod_push.bats | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libpod/runtime.go b/libpod/runtime.go index cf7ef3f1..47dd9d19 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -3,6 +3,7 @@ package libpod import ( "sync" + is "github.com/containers/image/storage" "github.com/containers/image/types" "github.com/containers/storage" "github.com/kubernetes-incubator/cri-o/server/apparmor" @@ -80,6 +81,7 @@ func NewRuntime(options ...RuntimeOption) (*Runtime, error) { return nil, err } runtime.store = store + is.Transport.SetStore(store) // Set up containers/image runtime.imageContext = &types.SystemContext{ diff --git a/test/kpod_push.bats b/test/kpod_push.bats index d1507f12..caa6916b 100644 --- a/test/kpod_push.bats +++ b/test/kpod_push.bats @@ -12,7 +12,7 @@ function teardown() { run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" containers-storage:[${TESTDIR}/crio]busybox:test + run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" containers-storage:busybox:test echo "$output" [ "$status" -eq 0 ] run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" busybox:test