mirror of
https://github.com/containers/podman.git
synced 2025-06-22 01:48:54 +08:00
Remove some more excessive wrapping and stuttering
Stop over wrapping API Calls The API calls will return an appropriate error, and this wrapping just makes the error message look like it is stuttering and a big mess. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -592,7 +592,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
|
|||||||
case "max-size":
|
case "max-size":
|
||||||
logSize, err := units.FromHumanSize(split[1])
|
logSize, err := units.FromHumanSize(split[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "%s is not a valid option", o)
|
return err
|
||||||
}
|
}
|
||||||
s.LogConfiguration.Size = logSize
|
s.LogConfiguration.Size = logSize
|
||||||
default:
|
default:
|
||||||
@ -662,7 +662,7 @@ func makeHealthCheckFromCli(inCmd, interval string, retries uint, timeout, start
|
|||||||
}
|
}
|
||||||
intervalDuration, err := time.ParseDuration(interval)
|
intervalDuration, err := time.ParseDuration(interval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "invalid healthcheck-interval %s ", interval)
|
return nil, errors.Wrapf(err, "invalid healthcheck-interval")
|
||||||
}
|
}
|
||||||
|
|
||||||
hc.Interval = intervalDuration
|
hc.Interval = intervalDuration
|
||||||
@ -673,7 +673,7 @@ func makeHealthCheckFromCli(inCmd, interval string, retries uint, timeout, start
|
|||||||
hc.Retries = int(retries)
|
hc.Retries = int(retries)
|
||||||
timeoutDuration, err := time.ParseDuration(timeout)
|
timeoutDuration, err := time.ParseDuration(timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "invalid healthcheck-timeout %s", timeout)
|
return nil, errors.Wrapf(err, "invalid healthcheck-timeout")
|
||||||
}
|
}
|
||||||
if timeoutDuration < time.Duration(1) {
|
if timeoutDuration < time.Duration(1) {
|
||||||
return nil, errors.New("healthcheck-timeout must be at least 1 second")
|
return nil, errors.New("healthcheck-timeout must be at least 1 second")
|
||||||
@ -682,7 +682,7 @@ func makeHealthCheckFromCli(inCmd, interval string, retries uint, timeout, start
|
|||||||
|
|
||||||
startPeriodDuration, err := time.ParseDuration(startPeriod)
|
startPeriodDuration, err := time.ParseDuration(startPeriod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "invalid healthcheck-start-period %s", startPeriod)
|
return nil, errors.Wrapf(err, "invalid healthcheck-start-period")
|
||||||
}
|
}
|
||||||
if startPeriodDuration < time.Duration(0) {
|
if startPeriodDuration < time.Duration(0) {
|
||||||
return nil, errors.New("healthcheck-start-period must be 0 seconds or greater")
|
return nil, errors.New("healthcheck-start-period must be 0 seconds or greater")
|
||||||
|
@ -250,7 +250,7 @@ func parseAndValidateRange(portRange string) (uint16, uint16, error) {
|
|||||||
func parseAndValidatePort(port string) (uint16, error) {
|
func parseAndValidatePort(port string) (uint16, error) {
|
||||||
num, err := strconv.Atoi(port)
|
num, err := strconv.Atoi(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, errors.Wrapf(err, "cannot parse %q as a port number", port)
|
return 0, errors.Wrapf(err, "invalid port number")
|
||||||
}
|
}
|
||||||
if num < 1 || num > 65535 {
|
if num < 1 || num > 65535 {
|
||||||
return 0, errors.Errorf("port numbers must be between 1 and 65535 (inclusive), got %d", num)
|
return 0, errors.Errorf("port numbers must be between 1 and 65535 (inclusive), got %d", num)
|
||||||
|
@ -57,7 +57,7 @@ func prune(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Print("Are you sure you want to continue? [y/N] ")
|
fmt.Print("Are you sure you want to continue? [y/N] ")
|
||||||
answer, err := reader.ReadString('\n')
|
answer, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading input")
|
return err
|
||||||
}
|
}
|
||||||
if strings.ToLower(answer)[0] != 'y' {
|
if strings.ToLower(answer)[0] != 'y' {
|
||||||
return nil
|
return nil
|
||||||
|
@ -205,7 +205,7 @@ func run(cmd *cobra.Command, args []string) error {
|
|||||||
if runRmi {
|
if runRmi {
|
||||||
_, rmErrors := registry.ImageEngine().Remove(registry.GetContext(), []string{imageName}, entities.ImageRemoveOptions{})
|
_, rmErrors := registry.ImageEngine().Remove(registry.GetContext(), []string{imageName}, entities.ImageRemoveOptions{})
|
||||||
if len(rmErrors) > 0 {
|
if len(rmErrors) > 0 {
|
||||||
logrus.Errorf("%s", errors.Wrapf(errorhandling.JoinErrors(rmErrors), "failed removing image"))
|
logrus.Errorf("%s", errorhandling.JoinErrors(rmErrors))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -353,18 +353,18 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
|||||||
|
|
||||||
isolation, err := parse.IsolationOption(flags.Isolation)
|
isolation, err := parse.IsolationOption(flags.Isolation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error parsing ID mapping options")
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
usernsOption, idmappingOptions, err := parse.IDMappingOptions(c, isolation)
|
usernsOption, idmappingOptions, err := parse.IDMappingOptions(c, isolation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error parsing ID mapping options")
|
return nil, err
|
||||||
}
|
}
|
||||||
nsValues = append(nsValues, usernsOption...)
|
nsValues = append(nsValues, usernsOption...)
|
||||||
|
|
||||||
systemContext, err := parse.SystemContextFromOptions(c)
|
systemContext, err := parse.SystemContextFromOptions(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error building system context")
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
format := ""
|
format := ""
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/utils"
|
"github.com/containers/podman/v2/cmd/podman/utils"
|
||||||
"github.com/containers/podman/v2/cmd/podman/validate"
|
"github.com/containers/podman/v2/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -60,7 +59,7 @@ WARNING! This will remove all dangling images.
|
|||||||
Are you sure you want to continue? [y/N] `)
|
Are you sure you want to continue? [y/N] `)
|
||||||
answer, err := reader.ReadString('\n')
|
answer, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading input")
|
return err
|
||||||
}
|
}
|
||||||
if strings.ToLower(answer)[0] != 'y' {
|
if strings.ToLower(answer)[0] != 'y' {
|
||||||
return nil
|
return nil
|
||||||
|
@ -58,7 +58,7 @@ func sign(cmd *cobra.Command, args []string) error {
|
|||||||
if len(signOptions.Directory) > 0 {
|
if len(signOptions.Directory) > 0 {
|
||||||
sigStoreDir = signOptions.Directory
|
sigStoreDir = signOptions.Directory
|
||||||
if _, err := os.Stat(sigStoreDir); err != nil {
|
if _, err := os.Stat(sigStoreDir); err != nil {
|
||||||
return errors.Wrapf(err, "invalid directory %s", sigStoreDir)
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_, err := registry.ImageEngine().Sign(registry.Context(), args, signOptions)
|
_, err := registry.ImageEngine().Sign(registry.Context(), args, signOptions)
|
||||||
|
@ -55,7 +55,7 @@ func setTrust(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
valid, err := image.IsValidImageURI(args[0])
|
valid, err := image.IsValidImageURI(args[0])
|
||||||
if err != nil || !valid {
|
if err != nil || !valid {
|
||||||
return errors.Wrapf(err, "invalid image uri %s", args[0])
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !util.StringInSlice(setOptions.Type, validTrustTypes) {
|
if !util.StringInSlice(setOptions.Type, validTrustTypes) {
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/registry"
|
"github.com/containers/podman/v2/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/containers/podman/v2/pkg/util"
|
"github.com/containers/podman/v2/pkg/util"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -116,7 +115,7 @@ func add(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
listID, err := registry.ImageEngine().ManifestAdd(context.Background(), manifestAddOpts.ManifestAddOptions)
|
listID, err := registry.ImageEngine().ManifestAdd(context.Background(), manifestAddOpts.ManifestAddOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error adding to manifest list %s", args[0])
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("%s\n", listID)
|
fmt.Printf("%s\n", listID)
|
||||||
return nil
|
return nil
|
||||||
|
@ -73,7 +73,7 @@ func annotate(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
updatedListID, err := registry.ImageEngine().ManifestAnnotate(context.Background(), args, manifestAnnotateOpts)
|
updatedListID, err := registry.ImageEngine().ManifestAnnotate(context.Background(), args, manifestAnnotateOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error removing from manifest list %s", listImageSpec)
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("%s\n", updatedListID)
|
fmt.Printf("%s\n", updatedListID)
|
||||||
return nil
|
return nil
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/common"
|
"github.com/containers/podman/v2/cmd/podman/common"
|
||||||
"github.com/containers/podman/v2/cmd/podman/registry"
|
"github.com/containers/podman/v2/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ func init() {
|
|||||||
func create(cmd *cobra.Command, args []string) error {
|
func create(cmd *cobra.Command, args []string) error {
|
||||||
imageID, err := registry.ImageEngine().ManifestCreate(context.Background(), args[:1], args[1:], manifestCreateOpts)
|
imageID, err := registry.ImageEngine().ManifestCreate(context.Background(), args[:1], args[1:], manifestCreateOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error creating manifest %s", args[0])
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("%s\n", imageID)
|
fmt.Printf("%s\n", imageID)
|
||||||
return nil
|
return nil
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/common"
|
"github.com/containers/podman/v2/cmd/podman/common"
|
||||||
"github.com/containers/podman/v2/cmd/podman/registry"
|
"github.com/containers/podman/v2/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ func init() {
|
|||||||
func inspect(cmd *cobra.Command, args []string) error {
|
func inspect(cmd *cobra.Command, args []string) error {
|
||||||
buf, err := registry.ImageEngine().ManifestInspect(context.Background(), args[0])
|
buf, err := registry.ImageEngine().ManifestInspect(context.Background(), args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error inspect manifest %s", args[0])
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("%s\n", buf)
|
fmt.Printf("%s\n", buf)
|
||||||
return nil
|
return nil
|
||||||
|
@ -108,7 +108,7 @@ func push(cmd *cobra.Command, args []string) error {
|
|||||||
manifestPushOpts.SkipTLSVerify = types.NewOptionalBool(!manifestPushOpts.TLSVerifyCLI)
|
manifestPushOpts.SkipTLSVerify = types.NewOptionalBool(!manifestPushOpts.TLSVerifyCLI)
|
||||||
}
|
}
|
||||||
if err := registry.ImageEngine().ManifestPush(registry.Context(), args, manifestPushOpts.ManifestPushOptions); err != nil {
|
if err := registry.ImageEngine().ManifestPush(registry.Context(), args, manifestPushOpts.ManifestPushOptions); err != nil {
|
||||||
return errors.Wrapf(err, "error pushing manifest %s to %s", listImageSpec, destSpec)
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ func create(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
if len(podIDFile) > 0 {
|
if len(podIDFile) > 0 {
|
||||||
if err = ioutil.WriteFile(podIDFile, []byte(response.Id), 0644); err != nil {
|
if err = ioutil.WriteFile(podIDFile, []byte(response.Id), 0644); err != nil {
|
||||||
return errors.Wrapf(err, "failed to write pod ID to file %q", podIDFile)
|
return errors.Wrapf(err, "failed to write pod ID to file")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println(response.Id)
|
fmt.Println(response.Id)
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/utils"
|
"github.com/containers/podman/v2/cmd/podman/utils"
|
||||||
"github.com/containers/podman/v2/cmd/podman/validate"
|
"github.com/containers/podman/v2/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ func prune(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Print("Are you sure you want to continue? [y/N] ")
|
fmt.Print("Are you sure you want to continue? [y/N] ")
|
||||||
answer, err := reader.ReadString('\n')
|
answer, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading input")
|
return err
|
||||||
}
|
}
|
||||||
if strings.ToLower(answer)[0] != 'y' {
|
if strings.ToLower(answer)[0] != 'y' {
|
||||||
return nil
|
return nil
|
||||||
|
@ -189,8 +189,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
|||||||
if cmd.Flag("cpu-profile").Changed {
|
if cmd.Flag("cpu-profile").Changed {
|
||||||
f, err := os.Create(cfg.CPUProfile)
|
f, err := os.Create(cfg.CPUProfile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "unable to create cpu profiling file %s",
|
return err
|
||||||
cfg.CPUProfile)
|
|
||||||
}
|
}
|
||||||
if err := pprof.StartCPUProfile(f); err != nil {
|
if err := pprof.StartCPUProfile(f); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -79,14 +79,14 @@ func add(cmd *cobra.Command, args []string) error {
|
|||||||
// Default to ssh: schema if none given
|
// Default to ssh: schema if none given
|
||||||
dest := args[1]
|
dest := args[1]
|
||||||
if match, err := regexp.Match(schemaPattern, []byte(dest)); err != nil {
|
if match, err := regexp.Match(schemaPattern, []byte(dest)); err != nil {
|
||||||
return errors.Wrapf(err, "internal regex error %q", schemaPattern)
|
return errors.Wrapf(err, "invalid destination")
|
||||||
} else if !match {
|
} else if !match {
|
||||||
dest = "ssh://" + dest
|
dest = "ssh://" + dest
|
||||||
}
|
}
|
||||||
|
|
||||||
uri, err := url.Parse(dest)
|
uri, err := url.Parse(dest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to parse %q", dest)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if uri.User.Username() == "" {
|
if uri.User.Username() == "" {
|
||||||
@ -109,7 +109,7 @@ func add(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
if uri.Path == "" || uri.Path == "/" {
|
if uri.Path == "" || uri.Path == "/" {
|
||||||
if uri.Path, err = getUDS(cmd, uri); err != nil {
|
if uri.Path, err = getUDS(cmd, uri); err != nil {
|
||||||
return errors.Wrapf(err, "failed to connect to %q", uri.String())
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ func getUserInfo(uri *url.URL) (*url.Userinfo, error) {
|
|||||||
if u, found := os.LookupEnv("_CONTAINERS_ROOTLESS_UID"); found {
|
if u, found := os.LookupEnv("_CONTAINERS_ROOTLESS_UID"); found {
|
||||||
usr, err = user.LookupId(u)
|
usr, err = user.LookupId(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to find user %q", u)
|
return nil, errors.Wrapf(err, "failed to lookup rootless user")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
usr, err = user.Current()
|
usr, err = user.Current()
|
||||||
@ -209,7 +209,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
|
|||||||
}
|
}
|
||||||
dial, err := ssh.Dial("tcp", uri.Host, cfg)
|
dial, err := ssh.Dial("tcp", uri.Host, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.Wrapf(err, "failed to connect to %q", uri.Host)
|
return "", errors.Wrapf(err, "failed to connect")
|
||||||
}
|
}
|
||||||
defer dial.Close()
|
defer dial.Close()
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
|
|||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
session.Stdout = &buffer
|
session.Stdout = &buffer
|
||||||
if err := session.Run(run); err != nil {
|
if err := session.Run(run); err != nil {
|
||||||
return "", errors.Wrapf(err, "failed to run %q", run)
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
var info define.Info
|
var info define.Info
|
||||||
@ -238,7 +238,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if info.Host.RemoteSocket == nil || len(info.Host.RemoteSocket.Path) == 0 {
|
if info.Host.RemoteSocket == nil || len(info.Host.RemoteSocket.Path) == 0 {
|
||||||
return "", fmt.Errorf("remote podman %q failed to report its UDS socket", uri.Host)
|
return "", errors.Errorf("remote podman %q failed to report its UDS socket", uri.Host)
|
||||||
}
|
}
|
||||||
return info.Host.RemoteSocket.Path, nil
|
return info.Host.RemoteSocket.Path, nil
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/validate"
|
"github.com/containers/podman/v2/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v2/libpod/events"
|
"github.com/containers/podman/v2/libpod/events"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -104,7 +103,7 @@ func eventsCmd(cmd *cobra.Command, _ []string) error {
|
|||||||
case doJSON:
|
case doJSON:
|
||||||
jsonStr, err := event.ToJSONString()
|
jsonStr, err := event.ToJSONString()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "unable to format json")
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(jsonStr)
|
fmt.Println(jsonStr)
|
||||||
case cmd.Flags().Changed("format"):
|
case cmd.Flags().Changed("format"):
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/utils"
|
"github.com/containers/podman/v2/cmd/podman/utils"
|
||||||
"github.com/containers/podman/v2/cmd/podman/validate"
|
"github.com/containers/podman/v2/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -68,7 +67,7 @@ WARNING! This will remove:
|
|||||||
Are you sure you want to continue? [y/N] `, volumeString)
|
Are you sure you want to continue? [y/N] `, volumeString)
|
||||||
answer, err := reader.ReadString('\n')
|
answer, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading input")
|
return err
|
||||||
}
|
}
|
||||||
if strings.ToLower(answer)[0] != 'y' {
|
if strings.ToLower(answer)[0] != 'y' {
|
||||||
return nil
|
return nil
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/validate"
|
"github.com/containers/podman/v2/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/containers/podman/v2/pkg/domain/infra"
|
"github.com/containers/podman/v2/pkg/domain/infra"
|
||||||
"github.com/pkg/errors"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ WARNING! This will remove:
|
|||||||
Are you sure you want to continue? [y/N] `)
|
Are you sure you want to continue? [y/N] `)
|
||||||
answer, err := reader.ReadString('\n')
|
answer, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(errors.Wrapf(err, "error reading input"))
|
logrus.Error(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if strings.ToLower(answer)[0] != 'y' {
|
if strings.ToLower(answer)[0] != 'y' {
|
||||||
@ -71,13 +71,13 @@ Are you sure you want to continue? [y/N] `)
|
|||||||
|
|
||||||
engine, err := infra.NewSystemEngine(entities.ResetMode, registry.PodmanConfig())
|
engine, err := infra.NewSystemEngine(entities.ResetMode, registry.PodmanConfig())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
logrus.Error(err)
|
||||||
os.Exit(125)
|
os.Exit(125)
|
||||||
}
|
}
|
||||||
defer engine.Shutdown(registry.Context())
|
defer engine.Shutdown(registry.Context())
|
||||||
|
|
||||||
if err := engine.Reset(registry.Context()); err != nil {
|
if err := engine.Reset(registry.Context()); err != nil {
|
||||||
fmt.Println(err)
|
logrus.Error(err)
|
||||||
os.Exit(125)
|
os.Exit(125)
|
||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
@ -33,7 +33,7 @@ func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entiti
|
|||||||
address := strings.Join(fields[1:], ":")
|
address := strings.Join(fields[1:], ":")
|
||||||
l, err := net.Listen(fields[0], address)
|
l, err := net.Listen(fields[0], address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "unable to create socket %s", opts.URI)
|
return errors.Wrapf(err, "unable to create socket")
|
||||||
}
|
}
|
||||||
listener = &l
|
listener = &l
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/containers/podman/v2/cmd/podman/utils"
|
"github.com/containers/podman/v2/cmd/podman/utils"
|
||||||
"github.com/containers/podman/v2/cmd/podman/validate"
|
"github.com/containers/podman/v2/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v2/pkg/domain/entities"
|
"github.com/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ func prune(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Print("Are you sure you want to continue? [y/N] ")
|
fmt.Print("Are you sure you want to continue? [y/N] ")
|
||||||
answer, err := reader.ReadString('\n')
|
answer, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading input")
|
return err
|
||||||
}
|
}
|
||||||
if strings.ToLower(answer)[0] != 'y' {
|
if strings.ToLower(answer)[0] != 'y' {
|
||||||
return nil
|
return nil
|
||||||
|
Reference in New Issue
Block a user