Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downloader: Add the image URL into the error message. #3098

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/pillar/cmd/downloader/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ func ociRepositorySplit(image string) (string, string, error) {
var registry, path string
imageURL, err := url.Parse(image)
if err != nil {
return registry, path, fmt.Errorf("invalid image URL: %v", err)
return registry, path, fmt.Errorf("invalid image URL: %s, %v", image, err)
}

if imageURL.Scheme != "docker" && imageURL.Scheme != "oci" {
return registry, path, fmt.Errorf("unknown OCI registry scheme %s", imageURL.Scheme)
return registry, path, fmt.Errorf("unknown OCI registry scheme %s, original URL: %s", imageURL.Scheme,
image)
}

// remove any leading slash on the path, as that can mess things up
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/cmd/downloader/resolveconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func resolveTagsToHash(ctx *downloaderContext, rc types.ResolveConfig,
// get the name of the repository and the URL for the registry
serverURL, remoteName, err = ociRepositorySplit(dsCtx.DownloadURL)
if err != nil {
errStr = fmt.Sprintf("invalid OCI registry URL: %s", serverURL)
errStr = fmt.Sprintf("invalid OCI registry URL: %s", err.Error())
}

default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/cmd/downloader/syncop.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func handleSyncOp(ctx *downloaderContext, key string,
// get the name of the repository and the URL for the registry
serverURL, remoteName, err = ociRepositorySplit(dsCtx.DownloadURL)
if err != nil {
errStr = fmt.Sprintf("invalid OCI registry URL: %s", serverURL)
errStr = fmt.Sprintf("invalid OCI registry URL: %s", err.Error())
}
case zconfig.DsType_DsS3.String():
auth = &zedUpload.AuthInput{
Expand Down