summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-06-02 11:46:24 -0700
committerJhon Honce <jhonce@redhat.com>2020-06-03 09:54:39 -0700
commitcbca6253282cc76be74b3005da80b63de94a8180 (patch)
tree54e8e7c0bab5d6a6fe0ca2e10757e9c7dfedffb4 /cmd
parent9bd48a64bbe63c0b8da4dfd3841f4d822fa1d5fb (diff)
downloadpodman-cbca6253282cc76be74b3005da80b63de94a8180.tar.gz
podman-cbca6253282cc76be74b3005da80b63de94a8180.tar.bz2
podman-cbca6253282cc76be74b3005da80b63de94a8180.zip
V2 Add support for ssh authentication methods
* podman --remote ssh://<user>:<password>@<host>:<port><path> * podman --remote ssh://<user>:<password>@<host>:<port><path> \ --identity <path> --passphrase <phrase> * ssh-add <key> podman --remote ssh://<user>@<host><path> * Fix `podman help` to run even if podman missing components * Prompt for passphrase on stdin IFF key is protected and passphrase not given via any other configuration * cobra flags do not support optional value flags therefore refactored --remote to be a boolean and --url will now contain the URI to Podman service Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/root.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 3796b8e27..59d536d0b 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -103,6 +103,11 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
cfg := registry.PodmanConfig()
+ // Help is a special case, no need for more setup
+ if cmd.Name() == "help" {
+ return nil
+ }
+
// Prep the engines
if _, err := registry.NewImageEngine(cmd, args); err != nil {
return err
@@ -150,6 +155,11 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
// TODO: Remove trace statement in podman V2.1
logrus.Debugf("Called %s.PersistentPostRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
+ // Help is a special case, no need for more cleanup
+ if cmd.Name() == "help" {
+ return nil
+ }
+
cfg := registry.PodmanConfig()
if cmd.Flag("cpu-profile").Changed {
pprof.StopCPUProfile()
@@ -191,8 +201,11 @@ func loggingHook() {
func rootFlags(opts *entities.PodmanConfig, flags *pflag.FlagSet) {
// V2 flags
- flags.StringVarP(&opts.Uri, "remote", "r", registry.DefaultAPIAddress(), "URL to access Podman service")
- flags.StringSliceVar(&opts.Identities, "identity", []string{}, "path to SSH identity file")
+ flags.BoolVarP(&opts.Remote, "remote", "r", false, "Access remote Podman service (default false)")
+ // TODO Read uri from containers.config when available
+ flags.StringVar(&opts.Uri, "url", registry.DefaultAPIAddress(), "URL to access Podman service (CONTAINER_HOST)")
+ flags.StringSliceVar(&opts.Identities, "identity", []string{}, "path to SSH identity file, (CONTAINER_SSHKEY)")
+ flags.StringVar(&opts.PassPhrase, "passphrase", "", "passphrase for identity file (not secure, CONTAINER_PASSPHRASE), ssh-agent always supported")
cfg := opts.Config
flags.StringVar(&cfg.Engine.CgroupManager, "cgroup-manager", cfg.Engine.CgroupManager, "Cgroup manager to use (\"cgroupfs\"|\"systemd\")")