summaryrefslogtreecommitdiff
path: root/cmd/podman/system
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/system')
-rw-r--r--cmd/podman/system/connection.go17
-rw-r--r--cmd/podman/system/connection/add.go2
-rw-r--r--cmd/podman/system/connection/default.go17
-rw-r--r--cmd/podman/system/connection/list.go13
-rw-r--r--cmd/podman/system/connection/remove.go17
-rw-r--r--cmd/podman/system/connection/rename.go17
-rw-r--r--cmd/podman/system/df.go1
-rw-r--r--cmd/podman/system/events.go1
-rw-r--r--cmd/podman/system/info.go3
-rw-r--r--cmd/podman/system/migrate.go2
-rw-r--r--cmd/podman/system/prune.go1
-rw-r--r--cmd/podman/system/renumber.go15
-rw-r--r--cmd/podman/system/reset.go2
-rw-r--r--cmd/podman/system/service.go13
-rw-r--r--cmd/podman/system/service_abi.go2
-rw-r--r--cmd/podman/system/system.go2
-rw-r--r--cmd/podman/system/unshare.go13
-rw-r--r--cmd/podman/system/version.go1
18 files changed, 57 insertions, 82 deletions
diff --git a/cmd/podman/system/connection.go b/cmd/podman/system/connection.go
index dbdda8cf9..1f8e8f13f 100644
--- a/cmd/podman/system/connection.go
+++ b/cmd/podman/system/connection.go
@@ -3,7 +3,6 @@ package system
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"
)
@@ -14,20 +13,18 @@ var (
}
ConnectionCmd = &cobra.Command{
- Use: "connection",
- Short: "Manage remote ssh destinations",
- Long: `Manage ssh destination information in podman configuration`,
- DisableFlagsInUseLine: true,
- PersistentPreRunE: noOp,
- RunE: validate.SubCommandExists,
- PersistentPostRunE: noOp,
- TraverseChildren: false,
+ Use: "connection",
+ Short: "Manage remote ssh destinations",
+ Long: `Manage ssh destination information in podman configuration`,
+ PersistentPreRunE: noOp,
+ RunE: validate.SubCommandExists,
+ PersistentPostRunE: noOp,
+ TraverseChildren: false,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: ConnectionCmd,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
index 89d28849c..ecfeb6608 100644
--- a/cmd/podman/system/connection/add.go
+++ b/cmd/podman/system/connection/add.go
@@ -15,7 +15,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
"github.com/containers/podman/v3/libpod/define"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/terminal"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -53,7 +52,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: addCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/connection/default.go b/cmd/podman/system/connection/default.go
index 073bdbc3f..cfedc337b 100644
--- a/cmd/podman/system/connection/default.go
+++ b/cmd/podman/system/connection/default.go
@@ -7,27 +7,24 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
var (
// Skip creating engines since this command will obtain connection information to said engines
dfltCmd = &cobra.Command{
- Use: "default NAME",
- Args: cobra.ExactArgs(1),
- Short: "Set named destination as default",
- Long: `Set named destination as default for the Podman service`,
- DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteSystemConnections,
- RunE: defaultRunE,
- Example: `podman system connection default testing`,
+ Use: "default NAME",
+ Args: cobra.ExactArgs(1),
+ Short: "Set named destination as default",
+ Long: `Set named destination as default for the Podman service`,
+ ValidArgsFunction: common.AutocompleteSystemConnections,
+ RunE: defaultRunE,
+ Example: `podman system connection default testing`,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: dfltCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/connection/list.go b/cmd/podman/system/connection/list.go
index fe7026ae3..ae88b0b30 100644
--- a/cmd/podman/system/connection/list.go
+++ b/cmd/podman/system/connection/list.go
@@ -10,18 +10,16 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
var (
listCmd = &cobra.Command{
- Use: "list",
- Aliases: []string{"ls"},
- Args: validate.NoArgs,
- Short: "List destination for the Podman service(s)",
- Long: `List destination information for the Podman service(s) in podman configuration`,
- DisableFlagsInUseLine: true,
+ Use: "list",
+ Aliases: []string{"ls"},
+ Args: validate.NoArgs,
+ Short: "List destination for the Podman service(s)",
+ Long: `List destination information for the Podman service(s) in podman configuration`,
Example: `podman system connection list
podman system connection ls`,
ValidArgsFunction: completion.AutocompleteNone,
@@ -32,7 +30,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: listCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/connection/remove.go b/cmd/podman/system/connection/remove.go
index 4acaa36a9..73bae4994 100644
--- a/cmd/podman/system/connection/remove.go
+++ b/cmd/podman/system/connection/remove.go
@@ -5,21 +5,19 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
var (
// Skip creating engines since this command will obtain connection information to said engines
rmCmd = &cobra.Command{
- Use: "remove NAME",
- Args: cobra.ExactArgs(1),
- Aliases: []string{"rm"},
- Long: `Delete named destination from podman configuration`,
- Short: "Delete named destination",
- DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteSystemConnections,
- RunE: rm,
+ Use: "remove NAME",
+ Args: cobra.ExactArgs(1),
+ Aliases: []string{"rm"},
+ Long: `Delete named destination from podman configuration`,
+ Short: "Delete named destination",
+ ValidArgsFunction: common.AutocompleteSystemConnections,
+ RunE: rm,
Example: `podman system connection remove devl
podman system connection rm devl`,
}
@@ -27,7 +25,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/connection/rename.go b/cmd/podman/system/connection/rename.go
index 7713c2b09..898457d38 100644
--- a/cmd/podman/system/connection/rename.go
+++ b/cmd/podman/system/connection/rename.go
@@ -7,21 +7,19 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
var (
// Skip creating engines since this command will obtain connection information to said engines
renameCmd = &cobra.Command{
- Use: "rename OLD NEW",
- Aliases: []string{"mv"},
- Args: cobra.ExactArgs(2),
- Short: "Rename \"old\" to \"new\"",
- Long: `Rename destination for the Podman service from "old" to "new"`,
- DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteSystemConnections,
- RunE: rename,
+ Use: "rename OLD NEW",
+ Aliases: []string{"mv"},
+ Args: cobra.ExactArgs(2),
+ Short: "Rename \"old\" to \"new\"",
+ Long: `Rename destination for the Podman service from "old" to "new"`,
+ ValidArgsFunction: common.AutocompleteSystemConnections,
+ RunE: rename,
Example: `podman system connection rename laptop devl,
podman system connection mv laptop devl`,
}
@@ -29,7 +27,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: renameCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/df.go b/cmd/podman/system/df.go
index 5e179a82d..de56c57d0 100644
--- a/cmd/podman/system/df.go
+++ b/cmd/podman/system/df.go
@@ -40,7 +40,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: dfSystemCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go
index 568610bdc..4aa413ec6 100644
--- a/cmd/podman/system/events.go
+++ b/cmd/podman/system/events.go
@@ -41,7 +41,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: eventsCommand,
})
flags := eventsCommand.Flags()
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index 44be4ccec..1dc90f79a 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -11,7 +11,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/libpod/define"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
)
@@ -49,13 +48,11 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: infoCommand,
})
infoFlags(infoCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: systemInfoCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go
index 892d60a38..9940cd063 100644
--- a/cmd/podman/system/migrate.go
+++ b/cmd/podman/system/migrate.go
@@ -22,6 +22,7 @@ var (
`
migrateCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "migrate [options]",
Args: validate.NoArgs,
Short: "Migrate containers",
@@ -37,7 +38,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: migrateCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go
index 0f1285564..e09e2d5e5 100644
--- a/cmd/podman/system/prune.go
+++ b/cmd/podman/system/prune.go
@@ -41,7 +41,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pruneCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go
index 91c49333a..83a873c2a 100644
--- a/cmd/podman/system/renumber.go
+++ b/cmd/podman/system/renumber.go
@@ -23,19 +23,18 @@ var (
`
renumberCommand = &cobra.Command{
- Use: "renumber",
- Args: validate.NoArgs,
- DisableFlagsInUseLine: true,
- Short: "Migrate lock numbers",
- Long: renumberDescription,
- Run: renumber,
- ValidArgsFunction: completion.AutocompleteNone,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "renumber",
+ Args: validate.NoArgs,
+ Short: "Migrate lock numbers",
+ Long: renumberDescription,
+ Run: renumber,
+ ValidArgsFunction: completion.AutocompleteNone,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: renumberCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index 6f2f873dd..0edb36889 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -23,6 +23,7 @@ var (
All containers will be stopped and removed, and all images, volumes and container content will be removed.
`
systemResetCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "reset [options]",
Args: validate.NoArgs,
Short: "Reset podman storage",
@@ -36,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: systemResetCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index 1e1cdbd12..a30f43839 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -28,6 +28,7 @@ Enable a listening service for API access to Podman commands.
`
srvCmd = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "service [options] [URI]",
Args: cobra.MaximumNArgs(1),
Short: "Run API service",
@@ -38,13 +39,13 @@ Enable a listening service for API access to Podman commands.
}
srvArgs = struct {
- Timeout int64
+ Timeout int64
+ CorsHeaders string
}{}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: srvCmd,
Parent: systemCmd,
})
@@ -54,6 +55,8 @@ func init() {
timeFlagName := "time"
flags.Int64VarP(&srvArgs.Timeout, timeFlagName, "t", 5, "Time until the service session expires in seconds. Use 0 to disable the timeout")
_ = srvCmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone)
+ flags.StringVarP(&srvArgs.CorsHeaders, "cors", "", "", "Set CORS Headers")
+ _ = srvCmd.RegisterFlagCompletionFunc("cors", completion.AutocompleteNone)
flags.SetNormalizeFunc(aliasTimeoutFlag)
}
@@ -71,7 +74,6 @@ func service(cmd *cobra.Command, args []string) error {
return err
}
logrus.Infof("using API endpoint: '%s'", apiURI)
-
// Clean up any old existing unix domain socket
if len(apiURI) > 0 {
uri, err := url.Parse(apiURI)
@@ -90,8 +92,9 @@ func service(cmd *cobra.Command, args []string) error {
}
opts := entities.ServiceOptions{
- URI: apiURI,
- Command: cmd,
+ URI: apiURI,
+ Command: cmd,
+ CorsHeaders: srvArgs.CorsHeaders,
}
opts.Timeout = time.Duration(srvArgs.Timeout) * time.Second
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 364663323..d59a45564 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -72,7 +72,7 @@ func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entiti
}
infra.StartWatcher(rt)
- server, err := api.NewServerWithSettings(rt, opts.Timeout, listener)
+ server, err := api.NewServerWithSettings(rt, listener, api.Options{Timeout: opts.Timeout, CorsHeaders: opts.CorsHeaders})
if err != nil {
return err
}
diff --git a/cmd/podman/system/system.go b/cmd/podman/system/system.go
index ab06c3ae0..1947decaf 100644
--- a/cmd/podman/system/system.go
+++ b/cmd/podman/system/system.go
@@ -3,7 +3,6 @@ package system
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: systemCmd,
})
}
diff --git a/cmd/podman/system/unshare.go b/cmd/podman/system/unshare.go
index c07751532..f930d8b62 100644
--- a/cmd/podman/system/unshare.go
+++ b/cmd/podman/system/unshare.go
@@ -15,12 +15,12 @@ var (
unshareOptions = entities.SystemUnshareOptions{}
unshareDescription = "Runs a command in a modified user namespace."
unshareCommand = &cobra.Command{
- Use: "unshare [options] [COMMAND [ARG...]]",
- DisableFlagsInUseLine: true,
- Short: "Run a command in a modified user namespace",
- Long: unshareDescription,
- RunE: unshare,
- ValidArgsFunction: completion.AutocompleteDefault,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "unshare [options] [COMMAND [ARG...]]",
+ Short: "Run a command in a modified user namespace",
+ Long: unshareDescription,
+ RunE: unshare,
+ ValidArgsFunction: completion.AutocompleteDefault,
Example: `podman unshare id
podman unshare cat /proc/self/uid_map,
podman unshare podman-script.sh`,
@@ -29,7 +29,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: unshareCommand,
})
flags := unshareCommand.Flags()
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index ad9fd2a85..5575fc87d 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -31,7 +31,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: versionCommand,
})
flags := versionCommand.Flags()