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

Improve debug output #518

Merged
merged 2 commits into from
Jan 17, 2025
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 internal/component/artifactory_release_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (ars *ArtifactoryReleaseSource) DownloadRelease(releaseDir string, remoteRe
}
downloadURL += "/" + ars.Repo + "/" + remoteRelease.RemotePath

ars.logger.Printf(logLineDownload, remoteRelease.Name, ReleaseSourceTypeArtifactory, ars.ID)
ars.logger.Printf(logLineDownload, remoteRelease.Name, remoteRelease.Version, ReleaseSourceTypeArtifactory, ars.ID)
resp, err := ars.getWithAuth(downloadURL)
if err != nil {
return Local{}, err
Expand Down Expand Up @@ -126,7 +126,6 @@ func (ars *ArtifactoryReleaseSource) DownloadRelease(releaseDir string, remoteRe

func (ars *ArtifactoryReleaseSource) getFileSHA1(release cargo.BOSHReleaseTarballLock) (string, error) {
fullURL := ars.ArtifactoryHost + "/api/storage/" + ars.Repo + "/" + release.RemotePath
ars.logger.Printf("Getting %s file info from artifactory", release.Name)
davewalter marked this conversation as resolved.
Show resolved Hide resolved

resp, err := ars.getWithAuth(fullURL)
if err != nil {
Expand Down Expand Up @@ -282,10 +281,12 @@ func (ars *ArtifactoryReleaseSource) FindReleaseVersion(spec cargo.BOSHReleaseTa
if (foundRelease == cargo.BOSHReleaseTarballLock{}) {
return cargo.BOSHReleaseTarballLock{}, ErrNotFound
}

foundRelease.SHA1, err = ars.getFileSHA1(foundRelease)
if err != nil {
return cargo.BOSHReleaseTarballLock{}, err
}

return foundRelease, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/component/bosh_io_release_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (src BOSHIOReleaseSource) FindReleaseVersion(spec cargo.BOSHReleaseTarballS
}

func (src BOSHIOReleaseSource) DownloadRelease(releaseDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error) {
src.logger.Printf(logLineDownload, remoteRelease.Name, ReleaseSourceTypeBOSHIO, src.ID())
src.logger.Printf(logLineDownload, remoteRelease.Name, remoteRelease.Version, ReleaseSourceTypeBOSHIO, src.ID())

downloadURL := remoteRelease.RemotePath

Expand Down
2 changes: 1 addition & 1 deletion internal/component/github_release_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ type ReleasesLister interface {
// It should also calculate and set the SHA1 field on the Local result; it does not need
// to ensure the sums match, the caller must verify this.
func (grs *GithubReleaseSource) DownloadRelease(releaseDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error) {
grs.Logger.Printf(logLineDownload, remoteRelease.Name, ReleaseSourceTypeGithub, grs.ID)
grs.Logger.Printf(logLineDownload, remoteRelease.Name, remoteRelease.Version, ReleaseSourceTypeGithub, grs.ID)
return downloadRelease(context.TODO(), releaseDir, remoteRelease, grs, grs.Logger)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/component/release_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type ReleaseSource interface {

const (
panicMessageWrongReleaseSourceType = "wrong constructor for release source configuration"
logLineDownload = "downloading %s from %s release source %s"
logLineDownload = "downloading %s %s from %s release source %s"
)

// TODO: use the constants from "cargo" everywhere
Expand Down
2 changes: 1 addition & 1 deletion internal/component/s3_release_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (src S3ReleaseSource) DownloadRelease(releaseDir string, lock cargo.BOSHRel
}
}

src.logger.Printf(logLineDownload, lock.Name, ReleaseSourceTypeS3, src.ID())
src.logger.Printf(logLineDownload, lock.Name, lock.Version, ReleaseSourceTypeS3, src.ID())

outputFile := filepath.Join(releaseDir, filepath.Base(lock.RemotePath))

Expand Down
Loading