File tree Expand file tree Collapse file tree 2 files changed +6
-27
lines changed Expand file tree Collapse file tree 2 files changed +6
-27
lines changed Original file line number Diff line number Diff line change 3
3
package system
4
4
5
5
import (
6
- "fmt"
7
- "os"
8
-
9
6
"github.com/containers/podman/v5/cmd/podman/registry"
10
7
"github.com/containers/podman/v5/cmd/podman/validate"
11
- "github.com/containers/podman/v5/libpod/define"
12
8
"github.com/containers/podman/v5/pkg/domain/entities"
13
9
"github.com/spf13/cobra"
14
10
"go.podman.io/common/pkg/completion"
30
26
Args : validate .NoArgs ,
31
27
Short : "Migrate containers" ,
32
28
Long : migrateDescription ,
33
- Run : migrate ,
29
+ RunE : migrate ,
34
30
ValidArgsFunction : completion .AutocompleteNone ,
35
31
}
36
32
)
@@ -52,13 +48,6 @@ func init() {
52
48
_ = migrateCommand .RegisterFlagCompletionFunc (newRuntimeFlagName , completion .AutocompleteNone )
53
49
}
54
50
55
- func migrate (cmd * cobra.Command , args []string ) {
56
- if err := registry .ContainerEngine ().Migrate (registry .Context (), migrateOptions ); err != nil {
57
- fmt .Println (err )
58
-
59
- // FIXME change this to return the error like other commands
60
- // defer will never run on os.Exit()
61
- os .Exit (define .ExecErrorCodeGeneric )
62
- }
63
- os .Exit (0 )
51
+ func migrate (cmd * cobra.Command , args []string ) error {
52
+ return registry .ContainerEngine ().Migrate (registry .Context (), migrateOptions )
64
53
}
Original file line number Diff line number Diff line change 3
3
package system
4
4
5
5
import (
6
- "fmt"
7
- "os"
8
-
9
6
"github.com/containers/podman/v5/cmd/podman/registry"
10
7
"github.com/containers/podman/v5/cmd/podman/validate"
11
- "github.com/containers/podman/v5/libpod/define"
12
8
"github.com/spf13/cobra"
13
9
"go.podman.io/common/pkg/completion"
14
10
)
27
23
Args : validate .NoArgs ,
28
24
Short : "Migrate lock numbers" ,
29
25
Long : renumberDescription ,
30
- Run : renumber ,
26
+ RunE : renumber ,
31
27
ValidArgsFunction : completion .AutocompleteNone ,
32
28
}
33
29
)
@@ -39,12 +35,6 @@ func init() {
39
35
})
40
36
}
41
37
42
- func renumber (cmd * cobra.Command , args []string ) {
43
- if err := registry .ContainerEngine ().Renumber (registry .Context ()); err != nil {
44
- fmt .Println (err )
45
- // FIXME change this to return the error like other commands
46
- // defer will never run on os.Exit()
47
- os .Exit (define .ExecErrorCodeGeneric )
48
- }
49
- os .Exit (0 )
38
+ func renumber (cmd * cobra.Command , args []string ) error {
39
+ return registry .ContainerEngine ().Renumber (registry .Context ())
50
40
}
You can’t perform that action at this time.
0 commit comments