diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-01 17:14:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-01 17:14:44 +0200 |
commit | 8b599c51268dc141bd963d8b5d3f25feadfcbb0e (patch) | |
tree | 6f6ade9a91ba306b3d27f7b8ae09da83830da7bd /pkg | |
parent | 12881abc065afda5bf979accfead542d411f48d6 (diff) | |
parent | f6438d36f3e52eb721f4223e767fd67b4c274d08 (diff) | |
download | podman-8b599c51268dc141bd963d8b5d3f25feadfcbb0e.tar.gz podman-8b599c51268dc141bd963d8b5d3f25feadfcbb0e.tar.bz2 podman-8b599c51268dc141bd963d8b5d3f25feadfcbb0e.zip |
Merge pull request #9894 from baude/machinesshfix
Remove --execute from podman machine ssh
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/machine/config.go | 3 | ||||
-rw-r--r-- | pkg/machine/qemu/machine.go | 21 |
2 files changed, 20 insertions, 4 deletions
diff --git a/pkg/machine/config.go b/pkg/machine/config.go index 554ea7c97..32b3b5c2b 100644 --- a/pkg/machine/config.go +++ b/pkg/machine/config.go @@ -56,8 +56,7 @@ type ListResponse struct { } type SSHOptions struct { - Execute bool - Args []string + Args []string } type StartOptions struct{} diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index b48926524..2652ebc10 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -400,7 +400,7 @@ func (v *MachineVM) SSH(name string, opts machine.SSHOptions) error { port := strconv.Itoa(v.Port) args := []string{"-i", v.IdentityPath, "-p", port, sshDestination} - if opts.Execute { + if len(opts.Args) > 0 { args = append(args, opts.Args...) } else { fmt.Printf("Connecting to vm %s. To close connection, use `~.` or `exit`\n", v.Name) @@ -446,7 +446,11 @@ func getDiskSize(path string) (uint64, error) { } // List lists all vm's that use qemu virtualization -func List(opts machine.ListOptions) ([]*machine.ListResponse, error) { +func List(_ machine.ListOptions) ([]*machine.ListResponse, error) { + return GetVMInfos() +} + +func GetVMInfos() ([]*machine.ListResponse, error) { vmConfigDir, err := machine.GetConfDir(vmtype) if err != nil { return nil, err @@ -493,3 +497,16 @@ func List(opts machine.ListOptions) ([]*machine.ListResponse, error) { } return listed, err } + +func IsValidVMName(name string) (bool, error) { + infos, err := GetVMInfos() + if err != nil { + return false, err + } + for _, vm := range infos { + if vm.Name == name { + return true, nil + } + } + return false, nil +} |