From 3cebdc68b83d9ec3acd01407f617c4e96f3af9a6 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 28 Jul 2018 03:29:32 +0200 Subject: Move source handling before destination parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow adding the reference in the OCIArchive/DockerArchive case in one step, instead of appending it later. Should not change behavior, except that source-related errors will now be reported before possible destination-related errors (but does not add unit tests). Signed-off-by: Miloslav Trmač Closes: #1176 Approved by: rhatdan --- cmd/podman/save.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/podman/save.go b/cmd/podman/save.go index 016fa580a..9f193a8f8 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -93,6 +93,12 @@ func saveCmd(c *cli.Context) error { return err } + source := args[0] + newImage, err := runtime.ImageRuntime().NewFromLocal(source) + if err != nil { + return err + } + var dst, manifestType string switch c.String("format") { case libpod.OCIArchive: @@ -119,11 +125,7 @@ func saveCmd(c *cli.Context) error { return err } } - source := args[0] - newImage, err := runtime.ImageRuntime().NewFromLocal(source) - if err != nil { - return err - } + dest := dst // need dest to be in the format transport:path:reference for the following transports if (strings.Contains(dst, libpod.OCIArchive) || strings.Contains(dst, libpod.DockerArchive)) && !strings.Contains(newImage.ID(), source) { -- cgit v1.2.3-54-g00ecf