summaryrefslogtreecommitdiff
path: root/cmd/podman/machine
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/machine')
-rw-r--r--cmd/podman/machine/init.go5
-rw-r--r--cmd/podman/machine/list.go6
-rw-r--r--cmd/podman/machine/ssh.go4
-rw-r--r--cmd/podman/machine/start.go5
4 files changed, 9 insertions, 11 deletions
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go
index f9ba7b30d..def3334e8 100644
--- a/cmd/podman/machine/init.go
+++ b/cmd/podman/machine/init.go
@@ -11,7 +11,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/libpod/events"
"github.com/containers/podman/v4/pkg/machine"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -120,12 +119,12 @@ func initMachine(cmd *cobra.Command, args []string) error {
initOpts.Name = defaultMachineName
if len(args) > 0 {
if len(args[0]) > maxMachineNameSize {
- return errors.Errorf("machine name %q must be %d characters or less", args[0], maxMachineNameSize)
+ return fmt.Errorf("machine name %q must be %d characters or less", args[0], maxMachineNameSize)
}
initOpts.Name = args[0]
}
if _, err := provider.LoadVMByName(initOpts.Name); err == nil {
- return errors.Wrap(machine.ErrVMAlreadyExists, initOpts.Name)
+ return fmt.Errorf("%s: %w", initOpts.Name, machine.ErrVMAlreadyExists)
}
for idx, vol := range initOpts.Volumes {
initOpts.Volumes[idx] = os.ExpandEnv(vol)
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index f904c0caa..b1e31566f 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -4,6 +4,7 @@
package machine
import (
+ "fmt"
"os"
"sort"
"strconv"
@@ -17,7 +18,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/validate"
"github.com/containers/podman/v4/pkg/machine"
"github.com/docker/go-units"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -89,7 +89,7 @@ func list(cmd *cobra.Command, args []string) error {
provider := GetSystemDefaultProvider()
listResponse, err = provider.List(opts)
if err != nil {
- return errors.Wrap(err, "error listing vms")
+ return fmt.Errorf("listing vms: %w", err)
}
// Sort by last run
@@ -158,7 +158,7 @@ func outputTemplate(cmd *cobra.Command, responses []*ListReporter) error {
defer w.Flush()
if printHeader {
if err := tmpl.Execute(w, headers); err != nil {
- return errors.Wrapf(err, "failed to write report column headers")
+ return fmt.Errorf("failed to write report column headers: %w", err)
}
}
return tmpl.Execute(w, responses)
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index 38b8914fb..cb2f62f51 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -4,6 +4,7 @@
package machine
import (
+ "fmt"
"net/url"
"github.com/containers/common/pkg/completion"
@@ -11,7 +12,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/utils"
"github.com/containers/podman/v4/pkg/machine"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -89,7 +89,7 @@ func ssh(cmd *cobra.Command, args []string) error {
vm, err = provider.LoadVMByName(vmName)
if err != nil {
- return errors.Wrapf(err, "vm %s not found", vmName)
+ return fmt.Errorf("vm %s not found: %w", vmName, err)
}
err = vm.SSH(vmName, sshOpts)
return utils.HandleOSExecError(err)
diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go
index e645bba87..15a75522a 100644
--- a/cmd/podman/machine/start.go
+++ b/cmd/podman/machine/start.go
@@ -9,7 +9,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/libpod/events"
"github.com/containers/podman/v4/pkg/machine"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -55,9 +54,9 @@ func start(_ *cobra.Command, args []string) error {
}
if active {
if vmName == activeName {
- return errors.Wrapf(machine.ErrVMAlreadyRunning, "cannot start VM %s", vmName)
+ return fmt.Errorf("cannot start VM %s: %w", vmName, machine.ErrVMAlreadyRunning)
}
- return errors.Wrapf(machine.ErrMultipleActiveVM, "cannot start VM %s. VM %s is currently running or starting", vmName, activeName)
+ return fmt.Errorf("cannot start VM %s. VM %s is currently running or starting: %w", vmName, activeName, machine.ErrMultipleActiveVM)
}
fmt.Printf("Starting machine %q\n", vmName)
if err := vm.Start(vmName, machine.StartOptions{}); err != nil {