summaryrefslogtreecommitdiff
path: root/cmd/podman/network_inspect.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-16 17:33:31 +0200
committerGitHub <noreply@github.com>2019-08-16 17:33:31 +0200
commit704cc582ac37fbbb7c8241a1cc09540f4976ed12 (patch)
tree57bb887e113b307a39865eb38d2b733e01c59f1c /cmd/podman/network_inspect.go
parent2d47f1ae5425faa6800606092e997bd565dc3a1c (diff)
parent6220ef1488d3e135c332c265fdb6a3c7b240b561 (diff)
downloadpodman-704cc582ac37fbbb7c8241a1cc09540f4976ed12.tar.gz
podman-704cc582ac37fbbb7c8241a1cc09540f4976ed12.tar.bz2
podman-704cc582ac37fbbb7c8241a1cc09540f4976ed12.zip
Merge pull request #3719 from baude/networklist
inclusion of podman network
Diffstat (limited to 'cmd/podman/network_inspect.go')
-rw-r--r--cmd/podman/network_inspect.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/cmd/podman/network_inspect.go b/cmd/podman/network_inspect.go
new file mode 100644
index 000000000..38aaf6ba4
--- /dev/null
+++ b/cmd/podman/network_inspect.go
@@ -0,0 +1,48 @@
+// +build !remoteclient
+
+package main
+
+import (
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/pkg/adapter"
+ "github.com/containers/libpod/pkg/rootless"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+)
+
+var (
+ networkinspectCommand cliconfig.NetworkInspectValues
+ networkinspectDescription = `Inspect network`
+ _networkinspectCommand = &cobra.Command{
+ Use: "inspect NETWORK [NETWORK...] [flags] ",
+ Short: "network inspect",
+ Long: networkinspectDescription,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ networkinspectCommand.InputArgs = args
+ networkinspectCommand.GlobalFlags = MainGlobalOpts
+ networkinspectCommand.Remote = remoteclient
+ return networkinspectCmd(&networkinspectCommand)
+ },
+ Example: `podman network inspect podman`,
+ }
+)
+
+func init() {
+ networkinspectCommand.Command = _networkinspectCommand
+ networkinspectCommand.SetHelpTemplate(HelpTemplate())
+ networkinspectCommand.SetUsageTemplate(UsageTemplate())
+}
+
+func networkinspectCmd(c *cliconfig.NetworkInspectValues) error {
+ if rootless.IsRootless() && !remoteclient {
+ return errors.New("network inspect is not supported for rootless mode")
+ }
+ if len(c.InputArgs) < 1 {
+ return errors.Errorf("at least one network name is required")
+ }
+ runtime, err := adapter.GetRuntimeNoStore(getContext(), &c.PodmanCommand)
+ if err != nil {
+ return err
+ }
+ return runtime.NetworkInspect(c)
+}