diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-06-28 19:07:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 19:07:52 +0000 |
commit | 60c9aeabab950be4b7b1d568c75bd3705bea17ed (patch) | |
tree | b6a93eccce4c6a22cd80a3f055430dd3085229dd /cmd/podman/root.go | |
parent | d8f197cc1491dace1ff12bff281d9adfbfd35761 (diff) | |
parent | 79a38a2c6aad30dd6e502c129a0672af24254586 (diff) | |
download | podman-60c9aeabab950be4b7b1d568c75bd3705bea17ed.tar.gz podman-60c9aeabab950be4b7b1d568c75bd3705bea17ed.tar.bz2 podman-60c9aeabab950be4b7b1d568c75bd3705bea17ed.zip |
Merge pull request #14717 from ZeyadYasser/fix-restore-runtime-check
Fix runtime check during restore
Diffstat (limited to 'cmd/podman/root.go')
-rw-r--r-- | cmd/podman/root.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go index 1892ff9f7..b3fba1158 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -143,16 +143,15 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { cmd.Flag("import").Value.String(), ) } - if cfg.RuntimePath == "" { + + runtimeFlag := cmd.Root().Flag("runtime") + if runtimeFlag == nil { + return errors.New("failed to load --runtime flag") + } + + if !runtimeFlag.Changed { // If the user did not select a runtime, this takes the one from // the checkpoint archives and tells Podman to use it for the restore. - runtimeFlag := cmd.Root().Flags().Lookup("runtime") - if runtimeFlag == nil { - return errors.Errorf( - "setting runtime to '%s' for restore", - *runtime, - ) - } if err := runtimeFlag.Value.Set(*runtime); err != nil { return err } |