mirror of
https://github.com/containers/skopeo.git
synced 2025-07-31 22:45:20 +00:00
Switch to using errors.Wrapf rather then fmt.Errorsf
We are using both functions throughout the code. Pick one and stick with it. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
7fee9122fb
commit
82e461ff9d
@ -90,7 +90,7 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error)
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := src.Close(); err != nil {
|
if err := src.Close(); err != nil {
|
||||||
retErr = errors.Wrapf(retErr, fmt.Sprintf("(could not close image: %v) ", err))
|
retErr = errors.Wrapf(retErr, "could not close image")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -104,14 +104,14 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error)
|
|||||||
if opts.raw && !opts.config {
|
if opts.raw && !opts.config {
|
||||||
_, err := stdout.Write(rawManifest)
|
_, err := stdout.Write(rawManifest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error writing manifest to standard output: %v", err)
|
return errors.Wrapf(err, "Error writing manifest to standard output")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
img, err := image.FromUnparsedImage(ctx, sys, image.UnparsedInstance(src, nil))
|
img, err := image.FromUnparsedImage(ctx, sys, image.UnparsedInstance(src, nil))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error parsing manifest for image: %v", err)
|
return errors.Wrapf(err, "Error parsing manifest for image")
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.config && opts.raw {
|
if opts.config && opts.raw {
|
||||||
@ -124,7 +124,7 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error)
|
|||||||
}
|
}
|
||||||
_, err = stdout.Write(configBlob)
|
_, err = stdout.Write(configBlob)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error writing configuration blob to standard output: %v", err)
|
return errors.Wrapf(err, "Error writing configuration blob to standard output")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
} else if opts.config {
|
} else if opts.config {
|
||||||
@ -137,7 +137,7 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error)
|
|||||||
}
|
}
|
||||||
err = json.NewEncoder(stdout).Encode(config)
|
err = json.NewEncoder(stdout).Encode(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error writing OCI-formatted configuration data to standard output: %v", err)
|
return errors.Wrapf(err, "Error writing OCI-formatted configuration data to standard output")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error)
|
|||||||
}
|
}
|
||||||
outputData.Digest, err = manifest.Digest(rawManifest)
|
outputData.Digest, err = manifest.Digest(rawManifest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error computing manifest digest: %v", err)
|
return errors.Wrapf(err, "Error computing manifest digest")
|
||||||
}
|
}
|
||||||
if dockerRef := img.Reference().DockerReference(); dockerRef != nil {
|
if dockerRef := img.Reference().DockerReference(); dockerRef != nil {
|
||||||
outputData.Name = dockerRef.Name()
|
outputData.Name = dockerRef.Name()
|
||||||
@ -182,7 +182,7 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error)
|
|||||||
// In addition, AWS ECR rejects it with 403 (Forbidden) if the "ecr:ListImages"
|
// In addition, AWS ECR rejects it with 403 (Forbidden) if the "ecr:ListImages"
|
||||||
// action is not allowed.
|
// action is not allowed.
|
||||||
if !strings.Contains(err.Error(), "401") && !strings.Contains(err.Error(), "403") {
|
if !strings.Contains(err.Error(), "401") && !strings.Contains(err.Error(), "403") {
|
||||||
return fmt.Errorf("Error determining repository tags: %v", err)
|
return errors.Wrapf(err, "Error determining repository tags")
|
||||||
}
|
}
|
||||||
logrus.Warnf("Registry disallows tag list retrieval; skipping")
|
logrus.Warnf("Registry disallows tag list retrieval; skipping")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user