summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-28 03:29:32 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-01 18:22:58 +0000
commit3cebdc68b83d9ec3acd01407f617c4e96f3af9a6 (patch)
treef09f04aac8d0d4000fe7f1a0cb4b7372ce0f72e7 /cmd
parent891392339fc75b2da37672c2c9a42a90f74a335b (diff)
downloadpodman-3cebdc68b83d9ec3acd01407f617c4e96f3af9a6.tar.gz
podman-3cebdc68b83d9ec3acd01407f617c4e96f3af9a6.tar.bz2
podman-3cebdc68b83d9ec3acd01407f617c4e96f3af9a6.zip
Move source handling before destination parsing
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č <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/save.go12
1 files changed, 7 insertions, 5 deletions
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) {