summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/machine/ssh.go29
-rw-r--r--docs/source/markdown/podman-machine-ssh.1.md6
-rw-r--r--libpod/boltdb_state_unsupported.go13
-rw-r--r--libpod/container_copy_unsupported.go16
-rw-r--r--libpod/container_internal_unsupported.go64
-rw-r--r--libpod/container_stat_unsupported.go13
-rw-r--r--libpod/container_top_unsupported.go23
-rw-r--r--libpod/container_unsupported.go5
-rw-r--r--libpod/healthcheck_unsupported.go21
-rw-r--r--libpod/networking_unsupported.go40
-rw-r--r--libpod/oci_attach_unsupported.go17
-rw-r--r--libpod/oci_conmon_unsupported.go132
-rw-r--r--libpod/pod_top_unsupported.go10
-rw-r--r--libpod/runtime_migrate_unsupported.go15
-rw-r--r--libpod/runtime_pod_unsupported.go18
-rw-r--r--libpod/runtime_volume_unsupported.go21
-rw-r--r--libpod/stats_unsupported.go10
-rw-r--r--libpod/util_unsupported.go34
-rw-r--r--libpod/volume_internal_unsupported.go15
19 files changed, 18 insertions, 484 deletions
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index 84e9e88ab..da0a09338 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -5,6 +5,7 @@ package machine
import (
"net/url"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/machine"
@@ -15,7 +16,7 @@ import (
var (
sshCmd = &cobra.Command{
- Use: "ssh [NAME] [COMMAND [ARG ...]]",
+ Use: "ssh [options] [NAME] [COMMAND [ARG ...]]",
Short: "SSH into an existing machine",
Long: "SSH into a managed virtual machine ",
RunE: ssh,
@@ -35,6 +36,10 @@ func init() {
Command: sshCmd,
Parent: machineCmd,
})
+ flags := sshCmd.Flags()
+ usernameFlagName := "username"
+ flags.StringVar(&sshOpts.Username, usernameFlagName, "", "Username to use when ssh-ing into the VM.")
+ _ = sshCmd.RegisterFlagCompletionFunc(usernameFlagName, completion.AutocompleteNone)
}
func ssh(cmd *cobra.Command, args []string) error {
@@ -48,13 +53,6 @@ func ssh(cmd *cobra.Command, args []string) error {
// Set the VM to default
vmName := defaultMachineName
- // If we're not given a VM name, use the remote username from the connection config
- if len(args) == 0 {
- sshOpts.Username, err = remoteConnectionUsername()
- if err != nil {
- return err
- }
- }
// If len is greater than 0, it means we may have been
// provided the VM name. If so, we check. The VM name,
// if provided, must be in args[0].
@@ -68,10 +66,6 @@ func ssh(cmd *cobra.Command, args []string) error {
if validVM {
vmName = args[0]
} else {
- sshOpts.Username, err = remoteConnectionUsername()
- if err != nil {
- return err
- }
sshOpts.Args = append(sshOpts.Args, args[0])
}
}
@@ -83,14 +77,17 @@ func ssh(cmd *cobra.Command, args []string) error {
if validVM {
sshOpts.Args = args[1:]
} else {
- sshOpts.Username, err = remoteConnectionUsername()
- if err != nil {
- return err
- }
sshOpts.Args = args
}
}
+ if !validVM && sshOpts.Username == "" {
+ sshOpts.Username, err = remoteConnectionUsername()
+ if err != nil {
+ return err
+ }
+ }
+
switch vmType {
default:
vm, err = qemu.LoadVMByName(vmName)
diff --git a/docs/source/markdown/podman-machine-ssh.1.md b/docs/source/markdown/podman-machine-ssh.1.md
index a5cf69107..c4c732819 100644
--- a/docs/source/markdown/podman-machine-ssh.1.md
+++ b/docs/source/markdown/podman-machine-ssh.1.md
@@ -4,7 +4,7 @@
podman\-machine\-ssh - SSH into a virtual machine
## SYNOPSIS
-**podman machine ssh** [*name*] [*command* [*arg* ...]]
+**podman machine ssh** [*options*] [*name*] [*command* [*arg* ...]]
## DESCRIPTION
@@ -21,6 +21,10 @@ with the virtual machine is established.
Print usage statement.
+#### **--username**=*name*
+
+Username to use when SSH-ing into the VM.
+
## EXAMPLES
To get an interactive session with the default virtual machine:
diff --git a/libpod/boltdb_state_unsupported.go b/libpod/boltdb_state_unsupported.go
deleted file mode 100644
index 244dc51a0..000000000
--- a/libpod/boltdb_state_unsupported.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build !linux
-
-package libpod
-
-// replaceNetNS is exclusive to the Linux platform and is a no-op elsewhere
-func replaceNetNS(netNSPath string, ctr *Container, newState *ContainerState) error {
- return nil
-}
-
-// getNetNSPath is exclusive to the Linux platform and is a no-op elsewhere
-func getNetNSPath(ctr *Container) string {
- return ""
-}
diff --git a/libpod/container_copy_unsupported.go b/libpod/container_copy_unsupported.go
deleted file mode 100644
index b2bdd3e3d..000000000
--- a/libpod/container_copy_unsupported.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
- "io"
-)
-
-func (c *Container) copyFromArchive(ctx context.Context, path string, reader io.Reader) (func() error, error) {
- return nil, nil
-}
-
-func (c *Container) copyToArchive(ctx context.Context, path string, writer io.Writer) (func() error, error) {
- return nil, nil
-}
diff --git a/libpod/container_internal_unsupported.go b/libpod/container_internal_unsupported.go
deleted file mode 100644
index 125329ce5..000000000
--- a/libpod/container_internal_unsupported.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
- "github.com/containers/podman/v3/pkg/lookup"
- spec "github.com/opencontainers/runtime-spec/specs-go"
-)
-
-func (c *Container) mountSHM(shmOptions string) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) unmountSHM(mount string) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) prepare() error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) cleanupNetwork() error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
- return nil, define.ErrNotImplemented
-}
-
-func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) restore(ctx context.Context, options ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) copyOwnerAndPerms(source, dest string) error {
- return nil
-}
-
-func (c *Container) getOCICgroupPath() (string, error) {
- return "", define.ErrNotImplemented
-}
-
-func (c *Container) cleanupOverlayMounts() error {
- return nil
-}
-
-func (c *Container) reloadNetwork() error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) getUserOverrides() *lookup.Overrides {
- return nil
-}
-
-// Fix ownership and permissions of the specified volume if necessary.
-func (c *Container) fixVolumePermissions(v *ContainerNamedVolume) error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/container_stat_unsupported.go b/libpod/container_stat_unsupported.go
deleted file mode 100644
index c002e4d32..000000000
--- a/libpod/container_stat_unsupported.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (c *Container) stat(ctx context.Context, containerMountPoint string, containerPath string) (*define.FileInfo, string, string, error) {
- return nil, "", "", nil
-}
diff --git a/libpod/container_top_unsupported.go b/libpod/container_top_unsupported.go
deleted file mode 100644
index 1a096d248..000000000
--- a/libpod/container_top_unsupported.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// Top gathers statistics about the running processes in a container. It returns a
-// []string for output
-func (c *Container) Top(descriptors []string) ([]string, error) {
- return nil, define.ErrNotImplemented
-}
-
-// GetContainerPidInformation returns process-related data of all processes in
-// the container. The output data can be controlled via the `descriptors`
-// argument which expects format descriptors and supports all AIXformat
-// descriptors of ps (1) plus some additional ones to for instance inspect the
-// set of effective capabilities. Each element in the returned string slice
-// is a tab-separated string.
-//
-// For more details, please refer to github.com/containers/psgo.
-func (c *Container) GetContainerPidInformation(descriptors []string) ([]string, error) {
- return nil, define.ErrNotImplemented
-}
diff --git a/libpod/container_unsupported.go b/libpod/container_unsupported.go
deleted file mode 100644
index e214b9465..000000000
--- a/libpod/container_unsupported.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// +build !linux
-
-package libpod
-
-type containerPlatformState struct{}
diff --git a/libpod/healthcheck_unsupported.go b/libpod/healthcheck_unsupported.go
deleted file mode 100644
index 8b6a0209b..000000000
--- a/libpod/healthcheck_unsupported.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// createTimer systemd timers for healthchecks of a container
-func (c *Container) createTimer() error {
- return define.ErrNotImplemented
-}
-
-// startTimer starts a systemd timer for the healthchecks
-func (c *Container) startTimer() error {
- return define.ErrNotImplemented
-}
-
-// removeTimer removes the systemd timer and unit files
-// for the container
-func (c *Container) removeTimer() error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/networking_unsupported.go b/libpod/networking_unsupported.go
deleted file mode 100644
index 20c27ca7f..000000000
--- a/libpod/networking_unsupported.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- cnitypes "github.com/containernetworking/cni/pkg/types/current"
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (r *Runtime) setupRootlessNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) setupSlirp4netns(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) setupNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) teardownNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) createNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, error) {
- return nil, define.ErrNotImplemented
-}
-
-func (r *Runtime) reloadContainerNetwork(ctr *Container) ([]*cnitypes.Result, error) {
- return nil, define.ErrNotImplemented
-}
-
-func getCNINetworksDir() (string, error) {
- return "", define.ErrNotImplemented
-}
diff --git a/libpod/oci_attach_unsupported.go b/libpod/oci_attach_unsupported.go
deleted file mode 100644
index 85e8b32e6..000000000
--- a/libpod/oci_attach_unsupported.go
+++ /dev/null
@@ -1,17 +0,0 @@
-//+build !linux
-
-package libpod
-
-import (
- "os"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (c *Container) attach(streams *define.AttachStreams, keys string, resize <-chan define.TerminalSize, startContainer bool, started chan bool, attachRdy chan<- bool) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) attachToExec(streams *define.AttachStreams, keys string, resize <-chan define.TerminalSize, sessionID string, startFd *os.File, attachFd *os.File) error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/oci_conmon_unsupported.go b/libpod/oci_conmon_unsupported.go
deleted file mode 100644
index 4de27d663..000000000
--- a/libpod/oci_conmon_unsupported.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "github.com/containers/common/pkg/config"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-const (
- osNotSupported = "Not supported on this OS"
-)
-
-// ConmonOCIRuntime is not supported on this OS.
-type ConmonOCIRuntime struct {
-}
-
-// newConmonOCIRuntime is not supported on this OS.
-func newConmonOCIRuntime(name string, paths []string, conmonPath string, runtimeFlags []string, runtimeCfg *config.Config) (OCIRuntime, error) {
- return nil, define.ErrNotImplemented
-}
-
-// Name is not supported on this OS.
-func (r *ConmonOCIRuntime) Name() string {
- return osNotSupported
-}
-
-// Path is not supported on this OS.
-func (r *ConmonOCIRuntime) Path() string {
- return osNotSupported
-}
-
-// CreateContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-// UpdateContainerStatus is not supported on this OS.
-func (r *ConmonOCIRuntime) UpdateContainerStatus(ctr *Container, useRuntime bool) error {
- return define.ErrNotImplemented
-}
-
-// StartContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) StartContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// KillContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) KillContainer(ctr *Container, signal uint, all bool) error {
- return define.ErrNotImplemented
-}
-
-// StopContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) StopContainer(ctr *Container, timeout uint, all bool) error {
- return define.ErrNotImplemented
-}
-
-// DeleteContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) DeleteContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// PauseContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) PauseContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// UnpauseContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) UnpauseContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// ExecContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) ExecContainer(ctr *Container, sessionID string, options *ExecOptions) (int, chan error, error) {
- return -1, nil, define.ErrNotImplemented
-}
-
-// ExecStopContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) ExecStopContainer(ctr *Container, sessionID string, timeout uint) error {
- return define.ErrNotImplemented
-}
-
-// CheckpointContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) CheckpointContainer(ctr *Container, options ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-// SupportsCheckpoint is not supported on this OS.
-func (r *ConmonOCIRuntime) SupportsCheckpoint() bool {
- return false
-}
-
-// SupportsJSONErrors is not supported on this OS.
-func (r *ConmonOCIRuntime) SupportsJSONErrors() bool {
- return false
-}
-
-// SupportsNoCgroups is not supported on this OS.
-func (r *ConmonOCIRuntime) SupportsNoCgroups() bool {
- return false
-}
-
-// AttachSocketPath is not supported on this OS.
-func (r *ConmonOCIRuntime) AttachSocketPath(ctr *Container) (string, error) {
- return "", define.ErrNotImplemented
-}
-
-// ExecAttachSocketPath is not supported on this OS.
-func (r *ConmonOCIRuntime) ExecAttachSocketPath(ctr *Container, sessionID string) (string, error) {
- return "", define.ErrNotImplemented
-}
-
-// ExitFilePath is not supported on this OS.
-func (r *ConmonOCIRuntime) ExitFilePath(ctr *Container) (string, error) {
- return "", define.ErrNotImplemented
-}
-
-// RuntimeInfo is not supported on this OS.
-func (r *ConmonOCIRuntime) RuntimeInfo() (*define.ConmonInfo, *define.OCIRuntimeInfo, error) {
- return nil, nil, define.ErrNotImplemented
-}
-
-// Package is not supported on this OS.
-func (r *ConmonOCIRuntime) Package() string {
- return osNotSupported
-}
-
-// ConmonPackage is not supported on this OS.
-func (r *ConmonOCIRuntime) ConmonPackage() string {
- return osNotSupported
-}
diff --git a/libpod/pod_top_unsupported.go b/libpod/pod_top_unsupported.go
deleted file mode 100644
index 59d2ff9a2..000000000
--- a/libpod/pod_top_unsupported.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// GetPodPidInformation is exclusive to linux
-func (p *Pod) GetPodPidInformation(descriptors []string) ([]string, error) {
- return nil, define.ErrNotImplemented
-}
diff --git a/libpod/runtime_migrate_unsupported.go b/libpod/runtime_migrate_unsupported.go
deleted file mode 100644
index a9d351318..000000000
--- a/libpod/runtime_migrate_unsupported.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-)
-
-func (r *Runtime) migrate(ctx context.Context) error {
- return nil
-}
-
-func (r *Runtime) stopPauseProcess() error {
- return nil
-}
diff --git a/libpod/runtime_pod_unsupported.go b/libpod/runtime_pod_unsupported.go
deleted file mode 100644
index 6dbcc9214..000000000
--- a/libpod/runtime_pod_unsupported.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-// NewPod makes a new, empty pod
-func (r *Runtime) NewPod(ctx context.Context, options ...PodCreateOption) (*Pod, error) {
- return nil, define.ErrOSNotSupported
-}
-
-func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
- return define.ErrOSNotSupported
-}
diff --git a/libpod/runtime_volume_unsupported.go b/libpod/runtime_volume_unsupported.go
deleted file mode 100644
index da7ee3552..000000000
--- a/libpod/runtime_volume_unsupported.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force bool) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) newVolume(ctx context.Context, options ...VolumeCreateOption) (*Volume, error) {
- return nil, define.ErrNotImplemented
-}
-
-func (r *Runtime) NewVolume(ctx context.Context, options ...VolumeCreateOption) (*Volume, error) {
- return nil, define.ErrNotImplemented
-}
diff --git a/libpod/stats_unsupported.go b/libpod/stats_unsupported.go
deleted file mode 100644
index 44a1c8d03..000000000
--- a/libpod/stats_unsupported.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// GetContainerStats gets the running stats for a given container
-func (c *Container) GetContainerStats(previousStats *define.ContainerStats) (*define.ContainerStats, error) {
- return nil, define.ErrOSNotSupported
-}
diff --git a/libpod/util_unsupported.go b/libpod/util_unsupported.go
deleted file mode 100644
index b718d36aa..000000000
--- a/libpod/util_unsupported.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "github.com/containers/podman/v3/libpod/define"
- "github.com/pkg/errors"
-)
-
-func systemdSliceFromPath(parent, name string) (string, error) {
- return "", errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-func makeSystemdCgroup(path string) error {
- return errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-func deleteSystemdCgroup(path string) error {
- return errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-func assembleSystemdCgroupName(baseSlice, newSlice string) (string, error) {
- return "", errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-// LabelVolumePath takes a mount path for a volume and gives it an
-// selinux label of either shared or not
-func LabelVolumePath(path string) error {
- return define.ErrNotImplemented
-}
-
-func Unmount(mount string) error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/volume_internal_unsupported.go b/libpod/volume_internal_unsupported.go
deleted file mode 100644
index 77452cf22..000000000
--- a/libpod/volume_internal_unsupported.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (v *Volume) mount() error {
- return define.ErrNotImplemented
-}
-
-func (v *Volume) unmount(force bool) error {
- return define.ErrNotImplemented
-}