diff options
author | Zeyad Yasser <zeyady98@gmail.com> | 2022-06-23 21:53:58 +0200 |
---|---|---|
committer | Zeyad Yasser <zeyady98@gmail.com> | 2022-06-28 16:14:38 +0200 |
commit | 8e3a46a87b1c14c8581737ecbd5db8698666c63d (patch) | |
tree | 8f837a7c42a10bb88b83818001fb5e9993d6daa9 /cmd | |
parent | c66a489b75b7bc68c341f0ff39d7beef95569878 (diff) | |
download | podman-8e3a46a87b1c14c8581737ecbd5db8698666c63d.tar.gz podman-8e3a46a87b1c14c8581737ecbd5db8698666c63d.tar.bz2 podman-8e3a46a87b1c14c8581737ecbd5db8698666c63d.zip |
Fix runtime check during restore
cfg.RuntimePath was set to default runtime, so the empty string
check fails. Instead we could check if the flag was changed.
Signed-off-by: Zeyad Yasser <zeyady98@gmail.com>
Diffstat (limited to 'cmd')
-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 } |