Skip to content

Commit

Permalink
Merge pull request #13660 from rhatdan/error
Browse files Browse the repository at this point in the history
Remove error stutter
  • Loading branch information
openshift-merge-robot authored Mar 27, 2022
2 parents 28504f5 + 7680211 commit ddfa087
Show file tree
Hide file tree
Showing 25 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions cmd/podman/images/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ func importCon(cmd *cobra.Command, args []string) error {
if source == "-" {
outFile, err := ioutil.TempFile("", "podman")
if err != nil {
return errors.Errorf("error creating file %v", err)
return errors.Errorf("creating file %v", err)
}
defer os.Remove(outFile.Name())
defer outFile.Close()

_, err = io.Copy(outFile, os.Stdin)
if err != nil {
return errors.Errorf("error copying file %v", err)
return errors.Errorf("copying file %v", err)
}
source = outFile.Name()
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/images/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ func load(cmd *cobra.Command, args []string) error {
}
outFile, err := ioutil.TempFile(util.Tmpdir(), "podman")
if err != nil {
return errors.Errorf("error creating file %v", err)
return errors.Errorf("creating file %v", err)
}
defer os.Remove(outFile.Name())
defer outFile.Close()

_, err = io.Copy(outFile, os.Stdin)
if err != nil {
return errors.Errorf("error copying file %v", err)
return errors.Errorf("copying file %v", err)
}
loadOpts.Input = outFile.Name()
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/images/scp.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func saveToRemote(image, localFile string, tag string, uri *urlP.URL, iden strin
}
n, err := scpD.CopyFrom(dial, remoteFile, localFile)
if _, conErr := connection.ExecRemoteCommand(dial, "rm "+remoteFile); conErr != nil {
logrus.Errorf("Error removing file on endpoint: %v", conErr)
logrus.Errorf("Removing file on endpoint: %v", conErr)
}
if err != nil {
errOut := strconv.Itoa(int(n)) + " Bytes copied before error"
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/inspect/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
fmt.Fprintf(os.Stderr, "error inspecting object: %v\n", err)
}
}
return errors.Errorf("error inspecting object: %v", errs[0])
return errors.Errorf("inspecting object: %v", errs[0])
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pods/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func create(cmd *cobra.Command, args []string) error {
return errors.Errorf("pod id file exists. Ensure another pod is not using it or delete %s", podIDFile)
}
if err != nil {
return errors.Errorf("error opening pod-id-file %s", podIDFile)
return errors.Errorf("opening pod-id-file %s", podIDFile)
}
defer errorhandling.CloseQuiet(podIDFD)
defer errorhandling.SyncQuiet(podIDFD)
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/secrets/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func inspect(cmd *cobra.Command, args []string) error {
fmt.Fprintf(os.Stderr, "error inspecting secret: %v\n", err)
}
}
return errors.Errorf("error inspecting secret: %v", errs[0])
return errors.Errorf("inspecting secret: %v", errs[0])
}
return nil
}
4 changes: 2 additions & 2 deletions cmd/podman/system/dial_stdio.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ func runDialStdio() error {
func copier(to halfWriteCloser, from halfReadCloser, debugDescription string) error {
defer func() {
if err := from.CloseRead(); err != nil {
logrus.Errorf("error while CloseRead (%s): %v", debugDescription, err)
logrus.Errorf("while CloseRead (%s): %v", debugDescription, err)
}
if err := to.CloseWrite(); err != nil {
logrus.Errorf("error while CloseWrite (%s): %v", debugDescription, err)
logrus.Errorf("while CloseWrite (%s): %v", debugDescription, err)
}
}()
if _, err := io.Copy(to, from); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/utils/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ func ExitCodeFromBuildError(errorMsg string) (int, error) {
return buildahCLI.ExecErrorCodeGeneric, err
}
}
return buildahCLI.ExecErrorCodeGeneric, errors.New("error message does not contains a valid exit code")
return buildahCLI.ExecErrorCodeGeneric, errors.New("message does not contains a valid exit code")
}
2 changes: 1 addition & 1 deletion libpod/networking_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e
}
}
// do not propagate error inspecting a joined network ns
logrus.Errorf("Error inspecting network namespace: %s of container %s: %v", networkNSPath, c.ID(), err)
logrus.Errorf("Inspecting network namespace: %s of container %s: %v", networkNSPath, c.ID(), err)
}
// We can't do more if the network is down.

Expand Down
2 changes: 1 addition & 1 deletion libpod/networking_slirp4netns.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ func (r *Runtime) setupRootlessPortMappingViaSlirp(ctr *Container, cmd *exec.Cmd
return errors.Wrapf(err, "error parsing error status from slirp4netns")
}
if e, found := y["error"]; found {
return errors.Errorf("error from slirp4netns while setting up port redirection: %v", e)
return errors.Errorf("from slirp4netns while setting up port redirection: %v", e)
}
}
logrus.Debug("slirp4netns port-forwarding setup via add_hostfwd is ready")
Expand Down
4 changes: 2 additions & 2 deletions pkg/bindings/containers/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
}
}
case fd == 3:
return fmt.Errorf("error from service from stream: %s", frame)
return fmt.Errorf("from service from stream: %s", frame)
default:
return fmt.Errorf("unrecognized channel '%d' in header, 0-3 supported", fd)
}
Expand Down Expand Up @@ -562,7 +562,7 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
}
}
case fd == 3:
return fmt.Errorf("error from service from stream: %s", frame)
return fmt.Errorf("from service from stream: %s", frame)
default:
return fmt.Errorf("unrecognized channel '%d' in header, 0-3 supported", fd)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindings/containers/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func Logs(ctx context.Context, nameOrID string, options *LogOptions, stdoutChan,
case 2:
stderrChan <- string(frame)
case 3:
return errors.New("error from service in stream: " + string(frame))
return errors.New("from service in stream: " + string(frame))
default:
return fmt.Errorf("unrecognized input header: %d", fd)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindings/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ func CheckResponseCode(inError error) (int, error) {
case *errorhandling.PodConflictErrorModel:
return e.Code(), nil
default:
return -1, errors.New("error is not type ErrorModel")
return -1, errors.New("is not type ErrorModel")
}
}
2 changes: 1 addition & 1 deletion pkg/bindings/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
if err != io.EOF {
return nil // non empty root dir, need to return
} else if err != nil {
logrus.Errorf("Error while reading directory %v: %v", path, err)
logrus.Errorf("While reading directory %v: %v", path, err)
}
}
name := filepath.ToSlash(strings.TrimPrefix(path, s+string(filepath.Separator)))
Expand Down
2 changes: 1 addition & 1 deletion pkg/domain/infra/abi/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestToDomainHistoryLayer(t *testing.T) {
// r := DirectImageRuntime{m}
// err := r.Delete(context.TODO(), actual, "fedora")
// if err != nil {
// t.Errorf("error should be nil, got: %v", err)
// t.Errorf("should be nil, got: %v", err)
// }
// m.AssertExpectations(t)
// }
2 changes: 1 addition & 1 deletion pkg/machine/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func DownloadVMImage(downloadURL *url2.URL, localImagePath string) error {
}()

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("error downloading VM image %s: %s", downloadURL, resp.Status)
return fmt.Errorf("downloading VM image %s: %s", downloadURL, resp.Status)
}
size := resp.ContentLength
urlSplit := strings.Split(downloadURL.Path, "/")
Expand Down
4 changes: 2 additions & 2 deletions pkg/machine/qemu/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
resize.Stdout = os.Stdout
resize.Stderr = os.Stderr
if err := resize.Run(); err != nil {
return false, errors.Errorf("error resizing image: %q", err)
return false, errors.Errorf("resizing image: %q", err)
}
}
// If the user provides an ignition file, we need to
Expand Down Expand Up @@ -1078,7 +1078,7 @@ func (v *MachineVM) isIncompatible() bool {
func (v *MachineVM) getForwardSocketPath() (string, error) {
path, err := machine.GetDataDir(v.Name)
if err != nil {
logrus.Errorf("Error resolving data dir: %s", err.Error())
logrus.Errorf("Resolving data dir: %s", err.Error())
return "", nil
}
return filepath.Join(path, "podman.sock"), nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/rootless/rootless.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TryJoinPauseProcess(pausePidPath string) (bool, int, error) {
if os.IsNotExist(err) {
return false, -1, nil
}
return false, -1, fmt.Errorf("error acquiring lock on %s: %w", pausePidPath, err)
return false, -1, fmt.Errorf("acquiring lock on %s: %w", pausePidPath, err)
}

pidFileLock.Lock()
Expand Down
12 changes: 6 additions & 6 deletions pkg/rootless/rootless_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func tryMappingTool(uid bool, pid int, hostID int, mappings []idtools.IDMap) err
}

if output, err := cmd.CombinedOutput(); err != nil {
logrus.Errorf("error running `%s`: %s", strings.Join(args, " "), output)
logrus.Errorf("running `%s`: %s", strings.Join(args, " "), output)
return errors.Wrapf(err, "cannot setup namespace using %q", path)
}
return nil
Expand Down Expand Up @@ -174,7 +174,7 @@ func joinUserAndMountNS(pid uint, pausePid string) (bool, int, error) {

ret := C.reexec_in_user_namespace_wait(pidC, 0)
if ret < 0 {
return false, -1, errors.New("error waiting for the re-exec process")
return false, -1, errors.New("waiting for the re-exec process")
}

return true, int(ret), nil
Expand Down Expand Up @@ -374,7 +374,7 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
if fileOutput != nil {
ret := C.reexec_in_user_namespace_wait(pidC, 0)
if ret < 0 {
return false, -1, errors.New("error waiting for the re-exec process")
return false, -1, errors.New("waiting for the re-exec process")
}

return true, 0, nil
Expand All @@ -391,11 +391,11 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
return joinUserAndMountNS(uint(pid), "")
}
}
return false, -1, errors.New("error setting up the process")
return false, -1, errors.New("setting up the process")
}

if b[0] != '0' {
return false, -1, errors.New("error setting up the process")
return false, -1, errors.New("setting up the process")
}

signals := []os.Signal{}
Expand Down Expand Up @@ -425,7 +425,7 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo

ret := C.reexec_in_user_namespace_wait(pidC, 0)
if ret < 0 {
return false, -1, errors.New("error waiting for the re-exec process")
return false, -1, errors.New("waiting for the re-exec process")
}

return true, int(ret), nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/specgen/generate/kube/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func VolumeFromHostPath(hostPath *v1.HostPathVolumeSource) (*KubeVolume, error)
return nil, errors.Wrap(err, "error checking HostPathSocket")
}
if st.Mode()&os.ModeSocket != os.ModeSocket {
return nil, errors.Errorf("error checking HostPathSocket: path %s is not a socket", hostPath.Path)
return nil, errors.Errorf("checking HostPathSocket: path %s is not a socket", hostPath.Path)
}

case v1.HostPathDirectory:
Expand Down
2 changes: 1 addition & 1 deletion pkg/specgen/generate/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func getVolumesFrom(volumesFrom []string, runtime *libpod.Runtime) (map[string]s
// and append them in if we can find them.
spec := ctr.Spec()
if spec == nil {
return nil, nil, errors.Errorf("error retrieving container %s spec for volumes-from", ctr.ID())
return nil, nil, errors.Errorf("retrieving container %s spec for volumes-from", ctr.ID())
}
for _, mnt := range spec.Mounts {
if mnt.Type != define.TypeBind {
Expand Down
2 changes: 1 addition & 1 deletion pkg/specgenutil/specgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ func parseThrottleIOPsDevices(iopsDevices []string) (map[string]specs.LinuxThrot
}

func parseSecrets(secrets []string) ([]specgen.Secret, map[string]string, error) {
secretParseError := errors.New("error parsing secret")
secretParseError := errors.New("parsing secret")
var mount []specgen.Secret
envs := make(map[string]string)
for _, val := range secrets {
Expand Down
4 changes: 2 additions & 2 deletions pkg/systemd/generate/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func PodUnits(pod *libpod.Pod, options entities.GenerateSystemdOptions) (map[str
// Error out if the pod has no infra container, which we require to be the
// main service.
if !pod.HasInfraContainer() {
return nil, errors.Errorf("error generating systemd unit files: Pod %q has no infra container", pod.Name())
return nil, errors.Errorf("generating systemd unit files: Pod %q has no infra container", pod.Name())
}

podInfo, err := generatePodInfo(pod, options)
Expand All @@ -160,7 +160,7 @@ func PodUnits(pod *libpod.Pod, options entities.GenerateSystemdOptions) (map[str
return nil, err
}
if len(containers) == 0 {
return nil, errors.Errorf("error generating systemd unit files: Pod %q has no containers", pod.Name())
return nil, errors.Errorf("generating systemd unit files: Pod %q has no containers", pod.Name())
}
graph, err := libpod.BuildContainerGraph(containers)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ func CreateCidFile(cidfile string, id string) error {
if os.IsExist(err) {
return errors.Errorf("container id file exists. Ensure another container is not using it or delete %s", cidfile)
}
return errors.Errorf("error opening cidfile %s", cidfile)
return errors.Errorf("opening cidfile %s", cidfile)
}
if _, err = cidFile.WriteString(id); err != nil {
logrus.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "--tz", badTZFile, "--rm", ALPINE, "date"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("error finding timezone for container"))
Expect(session.ErrorToString()).To(ContainSubstring("finding timezone for container"))

err = os.Remove(tzFile)
Expect(err).To(BeNil())
Expand Down

0 comments on commit ddfa087

Please sign in to comment.