diff options
author | baude <bbaude@redhat.com> | 2021-03-30 13:06:58 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2021-03-31 12:51:33 -0500 |
commit | f6438d36f3e52eb721f4223e767fd67b4c274d08 (patch) | |
tree | 50ecb0b5c4d1bbbb9742657742cec4f0b835ef01 /pkg/machine/qemu/machine.go | |
parent | 2e72b13823f1be199e483f34899723819d1dc474 (diff) | |
download | podman-f6438d36f3e52eb721f4223e767fd67b4c274d08.tar.gz podman-f6438d36f3e52eb721f4223e767fd67b4c274d08.tar.bz2 podman-f6438d36f3e52eb721f4223e767fd67b4c274d08.zip |
Remove --execute from podman machine ssh
The --execute flag ended up serving no purpose. It was removed and
documentation was updated.
Fixed a panic when no VM name was provided.
[NO TESTS NEEDED]
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/machine/qemu/machine.go')
-rw-r--r-- | pkg/machine/qemu/machine.go | 21 |
1 files changed, 19 insertions, 2 deletions
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 +} |