summaryrefslogtreecommitdiff
path: root/cmd/podman/networks
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/networks
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/networks')
-rw-r--r--cmd/podman/networks/connect.go1
-rw-r--r--cmd/podman/networks/create.go1
-rw-r--r--cmd/podman/networks/disconnect.go1
-rw-r--r--cmd/podman/networks/exists.go2
-rw-r--r--cmd/podman/networks/inspect.go1
-rw-r--r--cmd/podman/networks/list.go1
-rw-r--r--cmd/podman/networks/network.go2
-rw-r--r--cmd/podman/networks/prune.go1
-rw-r--r--cmd/podman/networks/reload.go10
-rw-r--r--cmd/podman/networks/rm.go1
10 files changed, 5 insertions, 16 deletions
diff --git a/cmd/podman/networks/connect.go b/cmd/podman/networks/connect.go
index 9fa088b78..0d62a45df 100644
--- a/cmd/podman/networks/connect.go
+++ b/cmd/podman/networks/connect.go
@@ -34,7 +34,6 @@ func networkConnectFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkConnectCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index 64ca2464a..1f3b321ba 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -75,7 +75,6 @@ func networkCreateFlags(cmd *cobra.Command) {
}
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkCreateCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/disconnect.go b/cmd/podman/networks/disconnect.go
index 26861eec6..7f2ff4252 100644
--- a/cmd/podman/networks/disconnect.go
+++ b/cmd/podman/networks/disconnect.go
@@ -31,7 +31,6 @@ func networkDisconnectFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkDisconnectCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/exists.go b/cmd/podman/networks/exists.go
index fdbd0ef11..89466ab7f 100644
--- a/cmd/podman/networks/exists.go
+++ b/cmd/podman/networks/exists.go
@@ -3,7 +3,6 @@ package network
import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkExistsCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go
index a05b9026d..c0e5b9720 100644
--- a/cmd/podman/networks/inspect.go
+++ b/cmd/podman/networks/inspect.go
@@ -24,7 +24,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkinspectCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index e1b182cbf..46872d078 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -54,7 +54,6 @@ func networkListFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networklistCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/network.go b/cmd/podman/networks/network.go
index 4d6cd8abd..ec045e3cf 100644
--- a/cmd/podman/networks/network.go
+++ b/cmd/podman/networks/network.go
@@ -3,7 +3,6 @@ package network
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/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkCmd,
})
}
diff --git a/cmd/podman/networks/prune.go b/cmd/podman/networks/prune.go
index 5f1cbda5f..e6b779ded 100644
--- a/cmd/podman/networks/prune.go
+++ b/cmd/podman/networks/prune.go
@@ -43,7 +43,6 @@ func networkPruneFlags(cmd *cobra.Command, flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkPruneCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/reload.go b/cmd/podman/networks/reload.go
index 035e56a07..371bea9ef 100644
--- a/cmd/podman/networks/reload.go
+++ b/cmd/podman/networks/reload.go
@@ -15,10 +15,11 @@ import (
var (
networkReloadDescription = `reload container networks, recreating firewall rules`
networkReloadCommand = &cobra.Command{
- Use: "reload [options] [CONTAINER...]",
- Short: "Reload firewall rules for one or more containers",
- Long: networkReloadDescription,
- RunE: networkReload,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "reload [options] [CONTAINER...]",
+ Short: "Reload firewall rules for one or more containers",
+ Long: networkReloadDescription,
+ RunE: networkReload,
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
@@ -39,7 +40,6 @@ func reloadFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: networkReloadCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/rm.go b/cmd/podman/networks/rm.go
index 1ae79b27d..14f9869e4 100644
--- a/cmd/podman/networks/rm.go
+++ b/cmd/podman/networks/rm.go
@@ -38,7 +38,6 @@ func networkRmFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkrmCommand,
Parent: networkCmd,
})