diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/containers/ps.go | 4 | ||||
-rw-r--r-- | cmd/podman/images/build.go | 7 | ||||
-rw-r--r-- | cmd/podman/inspect/inspect.go | 12 | ||||
-rw-r--r-- | cmd/podman/machine/init.go | 4 | ||||
-rw-r--r-- | cmd/podman/machine/list.go | 2 | ||||
-rw-r--r-- | cmd/podman/machine/rm.go | 2 | ||||
-rw-r--r-- | cmd/podman/machine/ssh.go | 6 | ||||
-rw-r--r-- | cmd/podman/machine/start.go | 2 | ||||
-rw-r--r-- | cmd/podman/machine/stop.go | 2 | ||||
-rw-r--r-- | cmd/podman/root.go | 8 |
10 files changed, 29 insertions, 20 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index 6b125fede..70bfd3574 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -232,7 +232,9 @@ func ps(cmd *cobra.Command, _ []string) error { ns := strings.NewReplacer(".Namespaces.", ".") format = ns.Replace(format) - tmpl, err := template.New("listContainers").Parse(format) + tmpl, err := template.New("listContainers"). + Funcs(template.FuncMap(report.DefaultFuncs)). + Parse(format) if err != nil { return err } diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index da7f5d862..04fdeab0a 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -11,6 +11,7 @@ import ( buildahDefine "github.com/containers/buildah/define" buildahCLI "github.com/containers/buildah/pkg/cli" "github.com/containers/buildah/pkg/parse" + "github.com/containers/common/pkg/auth" "github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/config" encconfig "github.com/containers/ocicrypt/config" @@ -330,6 +331,12 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil pullPolicy = buildahDefine.PullNever } + if c.Flag("authfile").Changed { + if err := auth.CheckAuthFile(flags.Authfile); err != nil { + return nil, err + } + } + args := make(map[string]string) if c.Flag("build-arg").Changed { for _, arg := range flags.BuildArg { diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go index 09721a2a8..351684af1 100644 --- a/cmd/podman/inspect/inspect.go +++ b/cmd/podman/inspect/inspect.go @@ -1,7 +1,6 @@ package inspect import ( - "bytes" "context" "encoding/json" // due to a bug in json-iterator it cannot be used here "fmt" @@ -246,15 +245,8 @@ func printJSON(data []interface{}) error { } func printTmpl(typ, row string, data []interface{}) error { - t, err := template.New(typ + " inspect").Funcs(map[string]interface{}{ - "json": func(v interface{}) string { - b := &bytes.Buffer{} - e := registry.JSONLibrary().NewEncoder(b) - e.SetEscapeHTML(false) - _ = e.Encode(v) - return strings.TrimSpace(b.String()) - }, - }).Parse(row) + // We cannot use c/common/reports here, too many levels of interface{} + t, err := template.New(typ + " inspect").Funcs(template.FuncMap(report.DefaultFuncs)).Parse(row) if err != nil { return err } diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go index 61261e008..02dfc80aa 100644 --- a/cmd/podman/machine/init.go +++ b/cmd/podman/machine/init.go @@ -15,8 +15,8 @@ import ( var ( initCmd = &cobra.Command{ Use: "init [options] [NAME]", - Short: "initialize a vm", - Long: "initialize a virtual machine for Podman to run on. Virtual machines are used to run Podman.", + Short: "Initialize a virtual machine", + Long: "initialize a virtual machine ", RunE: initMachine, Args: cobra.MaximumNArgs(1), Example: `podman machine init myvm`, diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go index 3c8368c6b..ce4129e87 100644 --- a/cmd/podman/machine/list.go +++ b/cmd/podman/machine/list.go @@ -28,7 +28,7 @@ var ( Use: "list [options]", Aliases: []string{"ls"}, Short: "List machines", - Long: "List Podman managed virtual machines.", + Long: "List managed virtual machines.", RunE: list, Args: validate.NoArgs, Example: `podman machine list, diff --git a/cmd/podman/machine/rm.go b/cmd/podman/machine/rm.go index e05b5f7a8..0be2ba40c 100644 --- a/cmd/podman/machine/rm.go +++ b/cmd/podman/machine/rm.go @@ -19,7 +19,7 @@ var ( rmCmd = &cobra.Command{ Use: "rm [options] [MACHINE]", Short: "Remove an existing machine", - Long: "Remove an existing machine ", + Long: "Remove a managed virtual machine ", RunE: rm, Args: cobra.MaximumNArgs(1), Example: `podman machine rm myvm`, diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go index fc7c71992..504fcbe46 100644 --- a/cmd/podman/machine/ssh.go +++ b/cmd/podman/machine/ssh.go @@ -14,11 +14,11 @@ import ( var ( sshCmd = &cobra.Command{ Use: "ssh [NAME] [COMMAND [ARG ...]]", - Short: "SSH into a virtual machine", - Long: "SSH into a virtual machine ", + Short: "SSH into an existing machine", + Long: "SSH into a managed virtual machine ", RunE: ssh, Example: `podman machine ssh myvm - podman machine ssh -e myvm echo hello`, + podman machine ssh myvm echo hello`, ValidArgsFunction: autocompleteMachineSSH, } ) diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go index 959fa21d2..d06e04f41 100644 --- a/cmd/podman/machine/start.go +++ b/cmd/podman/machine/start.go @@ -14,7 +14,7 @@ var ( startCmd = &cobra.Command{ Use: "start [MACHINE]", Short: "Start an existing machine", - Long: "Start an existing machine ", + Long: "Start a managed virtual machine ", RunE: start, Args: cobra.MaximumNArgs(1), Example: `podman machine start myvm`, diff --git a/cmd/podman/machine/stop.go b/cmd/podman/machine/stop.go index 36b434d8e..4235b64f1 100644 --- a/cmd/podman/machine/stop.go +++ b/cmd/podman/machine/stop.go @@ -14,7 +14,7 @@ var ( stopCmd = &cobra.Command{ Use: "stop [MACHINE]", Short: "Stop an existing machine", - Long: "Stop an existing machine ", + Long: "Stop a managed virtual machine ", RunE: stop, Args: cobra.MaximumNArgs(1), Example: `podman machine stop myvm`, diff --git a/cmd/podman/root.go b/cmd/podman/root.go index 2b77afbeb..4527c2646 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -180,6 +180,10 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { os.Setenv("TMPDIR", "/var/tmp") } + context := cmd.Root().LocalFlags().Lookup("context") + if context.Value.String() != "default" { + return errors.New("Podman does not support swarm, the only --context value allowed is \"default\"") + } if !registry.IsRemote() { if cmd.Flag("cpu-profile").Changed { f, err := os.Create(cfg.CPUProfile) @@ -269,6 +273,10 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) { lFlags.StringVar(&opts.URI, urlFlagName, uri, "URL to access Podman service (CONTAINER_HOST)") _ = cmd.RegisterFlagCompletionFunc(urlFlagName, completion.AutocompleteDefault) + // Context option added just for compatibility with DockerCLI. + lFlags.String("context", "default", "Name of the context to use to connect to the daemon (This flag is a NOOP and provided solely for scripting compatibility.)") + _ = lFlags.MarkHidden("context") + identityFlagName := "identity" lFlags.StringVar(&opts.Identity, identityFlagName, ident, "path to SSH identity file, (CONTAINER_SSHKEY)") _ = cmd.RegisterFlagCompletionFunc(identityFlagName, completion.AutocompleteDefault) |