diff --git a/server/inspect.go b/server/inspect.go index 017c4242957..a6454ffe041 100644 --- a/server/inspect.go +++ b/server/inspect.go @@ -74,12 +74,6 @@ func (s *Server) getContainerInfo(id string, getContainerFunc, getInfraContainer logrus.Debugf("can't find sandbox %s for container %s", ctr.Sandbox(), id) return types.ContainerInfo{}, errSandboxNotFound } - image := ctr.Image() - if s.ContainerServer != nil && s.ContainerServer.StorageImageServer() != nil { - if status, err := s.ContainerServer.StorageImageServer().ImageStatus(s.config.SystemContext, ctr.ImageRef()); err == nil { - image = status.Name - } - } pidToReturn := ctrState.Pid if isInfra && pidToReturn == 0 { @@ -100,7 +94,7 @@ func (s *Server) getContainerInfo(id string, getContainerFunc, getInfraContainer return types.ContainerInfo{ Name: ctr.Name(), Pid: pidToReturn, - Image: image, + Image: ctr.ImageName(), ImageRef: ctr.ImageRef(), CreatedTime: ctrState.Created.UnixNano(), Labels: ctr.Labels(), diff --git a/server/inspect_ginkgo_test.go b/server/inspect_ginkgo_test.go index 83d6dee1cee..2d2b73ce025 100644 --- a/server/inspect_ginkgo_test.go +++ b/server/inspect_ginkgo_test.go @@ -5,9 +5,7 @@ import ( "net/http/httptest" "github.com/cri-o/cri-o/internal/oci" - "github.com/cri-o/cri-o/internal/storage" "github.com/go-zoo/bone" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -49,10 +47,6 @@ var _ = t.Describe("Inspect", func() { testContainer.SetStateAndSpoofPid(&oci.ContainerState{}) Expect(testSandbox.SetInfraContainer(testContainer)).To(BeNil()) sut.AddContainer(testContainer) - gomock.InOrder( - imageServerMock.EXPECT().ImageStatus(gomock.Any(), - gomock.Any()).Return(&storage.ImageResult{}, nil), - ) // When request, err := http.NewRequest("GET", diff --git a/server/inspect_test.go b/server/inspect_test.go index 1aacd73ace9..c51942bd817 100644 --- a/server/inspect_test.go +++ b/server/inspect_test.go @@ -81,8 +81,8 @@ func TestGetContainerInfo(t *testing.T) { if ci.Name != "testname" { t.Fatalf("expected name testname, got %s", ci.Name) } - if ci.Image != "image" { - t.Fatalf("expected image name image, got %s", ci.Image) + if ci.Image != "imageName" { + t.Fatalf("expected image name imageName, got %s", ci.Image) } if ci.ImageRef != "imageRef" { t.Fatalf("expected image ref imageRef, got %s", ci.ImageRef)