summaryrefslogtreecommitdiff
path: root/cmd/podman/machine
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-05-18 11:23:25 -0700
committerJhon Honce <jhonce@redhat.com>2021-05-27 11:40:43 -0700
commit33944cefe7c1f3e11c8389bedb3e4c80af8541bd (patch)
tree594d3da7b2cb2a8620be0afbca2cd27087192326 /cmd/podman/machine
parent4f4a440afd521913745c314f2bebd0da45d9668e (diff)
downloadpodman-33944cefe7c1f3e11c8389bedb3e4c80af8541bd.tar.gz
podman-33944cefe7c1f3e11c8389bedb3e4c80af8541bd.tar.bz2
podman-33944cefe7c1f3e11c8389bedb3e4c80af8541bd.zip
[Techinal Debt] Cleanup ABI vs. Tunnel CLI commands
[NO TESTS NEEDED] This commit cleans up two issues: * Most commands support all EngineModes so default to that. Let outlayers declare their intent. * Use cobra.Annotations to set supported EngineMode. This simplies instantiating commands as there is now one method to communicate a commands requirements rather than two. * Combined aliased commands into one file * Fixed aliased commands where Args field did not match * Updated examples in README.md for writing commands * Remove redundant flag DisableFlagsInUseLine in cobra.Command initialization. Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/machine')
-rw-r--r--cmd/podman/machine/init.go6
-rw-r--r--cmd/podman/machine/list.go16
-rw-r--r--cmd/podman/machine/machine.go2
-rw-r--r--cmd/podman/machine/machine_unsupported.go1
-rw-r--r--cmd/podman/machine/rm.go2
-rw-r--r--cmd/podman/machine/ssh.go2
-rw-r--r--cmd/podman/machine/start.go2
-rw-r--r--cmd/podman/machine/stop.go2
8 files changed, 10 insertions, 23 deletions
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go
index 02dfc80aa..f4133dbde 100644
--- a/cmd/podman/machine/init.go
+++ b/cmd/podman/machine/init.go
@@ -5,7 +5,6 @@ package machine
import (
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/pkg/errors"
@@ -25,13 +24,12 @@ var (
)
var (
- initOpts = machine.InitOptions{}
- defaultMachineName string = "podman-machine-default"
+ initOpts = machine.InitOptions{}
+ defaultMachineName = "podman-machine-default"
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: initCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index af4e2c807..77b47161a 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -15,7 +15,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/docker/go-units"
@@ -25,15 +24,15 @@ import (
var (
lsCmd = &cobra.Command{
- Use: "list [options]",
- Aliases: []string{"ls"},
- Short: "List machines",
- Long: "List managed virtual machines.",
- RunE: list,
- Args: validate.NoArgs,
+ Use: "list [options]",
+ Aliases: []string{"ls"},
+ Short: "List machines",
+ Long: "List managed virtual machines.",
+ RunE: list,
+ Args: validate.NoArgs,
+ ValidArgsFunction: completion.AutocompleteNone,
Example: `podman machine list,
podman machine ls`,
- ValidArgsFunction: completion.AutocompleteNone,
}
listFlag = listFlagType{}
)
@@ -52,7 +51,6 @@ type machineReporter struct {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: lsCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/machine.go b/cmd/podman/machine/machine.go
index d8cdf5568..b059afc38 100644
--- a/cmd/podman/machine/machine.go
+++ b/cmd/podman/machine/machine.go
@@ -7,7 +7,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/spf13/cobra"
@@ -30,7 +29,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: machineCmd,
})
}
diff --git a/cmd/podman/machine/machine_unsupported.go b/cmd/podman/machine/machine_unsupported.go
index 3bb44b51f..f8392694a 100644
--- a/cmd/podman/machine/machine_unsupported.go
+++ b/cmd/podman/machine/machine_unsupported.go
@@ -2,4 +2,5 @@
package machine
+// init do not register _podman machine_ command on unsupported platforms
func init() {}
diff --git a/cmd/podman/machine/rm.go b/cmd/podman/machine/rm.go
index 0be2ba40c..02e3dfeb8 100644
--- a/cmd/podman/machine/rm.go
+++ b/cmd/podman/machine/rm.go
@@ -9,7 +9,6 @@ import (
"strings"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/spf13/cobra"
@@ -33,7 +32,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index ecc6d3b82..b52a48faf 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -4,7 +4,6 @@ package machine
import (
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/pkg/errors"
@@ -30,7 +29,6 @@ var (
func init() {
sshCmd.Flags().SetInterspersed(false)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: sshCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go
index 4334cfc0f..f8f0eed09 100644
--- a/cmd/podman/machine/start.go
+++ b/cmd/podman/machine/start.go
@@ -4,7 +4,6 @@ package machine
import (
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/pkg/errors"
@@ -25,7 +24,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: startCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/stop.go b/cmd/podman/machine/stop.go
index 4307d3eeb..2d5aa7b95 100644
--- a/cmd/podman/machine/stop.go
+++ b/cmd/podman/machine/stop.go
@@ -4,7 +4,6 @@ package machine
import (
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/spf13/cobra"
@@ -24,7 +23,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: stopCmd,
Parent: machineCmd,
})