summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-07-22 12:51:49 +0200
committerGitHub <noreply@github.com>2022-07-22 12:51:49 +0200
commit9bba3cffc08ba7cdf83af98f0b08510d8f4e0ac6 (patch)
tree06234d7baf93999a58f052add1ffeacbf454c508 /cmd
parent1f357892521e6b5f8b9dd877b54b2cf9be96b826 (diff)
parent88b57dd9f1cb56c65e2ccce9979ce7e89c20a855 (diff)
downloadpodman-9bba3cffc08ba7cdf83af98f0b08510d8f4e0ac6.tar.gz
podman-9bba3cffc08ba7cdf83af98f0b08510d8f4e0ac6.tar.bz2
podman-9bba3cffc08ba7cdf83af98f0b08510d8f4e0ac6.zip
Merge pull request #15010 from Luap99/machine-e2e
enable linter for pkg/machine/e2e
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/machine/info.go29
-rw-r--r--cmd/podman/machine/ssh.go9
2 files changed, 10 insertions, 28 deletions
diff --git a/cmd/podman/machine/info.go b/cmd/podman/machine/info.go
index 9932027d8..418060675 100644
--- a/cmd/podman/machine/info.go
+++ b/cmd/podman/machine/info.go
@@ -16,6 +16,7 @@ import (
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/validate"
"github.com/containers/podman/v4/libpod/define"
+ "github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/machine"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
@@ -40,26 +41,6 @@ var (
inFormat string
)
-// Info contains info on the machine host and version info
-type Info struct {
- Host *HostInfo `json:"Host"`
- Version define.Version `json:"Version"`
-}
-
-// HostInfo contains info on the machine host
-type HostInfo struct {
- Arch string `json:"Arch"`
- CurrentMachine string `json:"CurrentMachine"`
- DefaultMachine string `json:"DefaultMachine"`
- EventsDir string `json:"EventsDir"`
- MachineConfigDir string `json:"MachineConfigDir"`
- MachineImageDir string `json:"MachineImageDir"`
- MachineState string `json:"MachineState"`
- NumberOfMachines int `json:"NumberOfMachines"`
- OS string `json:"OS"`
- VMType string `json:"VMType"`
-}
-
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: infoCmd,
@@ -69,11 +50,11 @@ func init() {
flags := infoCmd.Flags()
formatFlagName := "format"
flags.StringVarP(&inFormat, formatFlagName, "f", "", "Change the output format to JSON or a Go template")
- _ = infoCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&define.Info{}))
+ _ = infoCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.MachineInfo{}))
}
func info(cmd *cobra.Command, args []string) error {
- info := Info{}
+ info := entities.MachineInfo{}
version, err := define.GetVersion()
if err != nil {
return fmt.Errorf("error getting version info %w", err)
@@ -112,8 +93,8 @@ func info(cmd *cobra.Command, args []string) error {
return nil
}
-func hostInfo() (*HostInfo, error) {
- host := HostInfo{}
+func hostInfo() (*entities.MachineHostInfo, error) {
+ host := entities.MachineHostInfo{}
host.Arch = runtime.GOARCH
host.OS = runtime.GOOS
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index cb2f62f51..8534b8efa 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -80,6 +80,11 @@ func ssh(cmd *cobra.Command, args []string) error {
}
}
+ vm, err = provider.LoadVMByName(vmName)
+ if err != nil {
+ return fmt.Errorf("vm %s not found: %w", vmName, err)
+ }
+
if !validVM && sshOpts.Username == "" {
sshOpts.Username, err = remoteConnectionUsername()
if err != nil {
@@ -87,10 +92,6 @@ func ssh(cmd *cobra.Command, args []string) error {
}
}
- vm, err = provider.LoadVMByName(vmName)
- if err != nil {
- return fmt.Errorf("vm %s not found: %w", vmName, err)
- }
err = vm.SSH(vmName, sshOpts)
return utils.HandleOSExecError(err)
}