fixed some general problems

imports, wrong logging calls and similar stuff. Unit tests work now
This commit is contained in:
miampf 2024-01-10 14:24:30 +01:00
parent c1168588e6
commit 69cbd155db
No known key found for this signature in database
GPG key ID: 376EAC0E5307A669
99 changed files with 342 additions and 329 deletions

View file

@ -115,14 +115,14 @@ func uploadReport(ctx context.Context,
return fmt.Errorf("kind %s not supported", cfg.kind)
}
log.Info("Reading SNP report from file: %s", cfg.path)
log.Info(fmt.Sprintf("Reading SNP report from file: %s", cfg.path))
var report verify.Report
if err := fs.ReadJSON(cfg.path, &report); err != nil {
return fmt.Errorf("reading snp report: %w", err)
}
inputVersion := convertTCBVersionToSNPVersion(report.SNPReport.LaunchTCB)
log.Info("Input report: %+v", inputVersion)
log.Info(fmt.Sprintf("Input report: %+v", inputVersion))
latestAPIVersionAPI, err := attestationconfigapi.NewFetcherWithCustomCDNAndCosignKey(cfg.url, cfg.cosignPublicKey).FetchSEVSNPVersionLatest(ctx, attestation)
if err != nil {
@ -136,7 +136,7 @@ func uploadReport(ctx context.Context,
latestAPIVersion := latestAPIVersionAPI.SEVSNPVersion
if err := client.UploadSEVSNPVersionLatest(ctx, attestation, inputVersion, latestAPIVersion, cfg.uploadDate, cfg.force); err != nil {
if errors.Is(err, attestationconfigapi.ErrNoNewerVersion) {
log.Info("Input version: %+v is not newer than latest API version: %+v", inputVersion, latestAPIVersion)
log.Info(fmt.Sprintf("Input version: %+v is not newer than latest API version: %+v", inputVersion, latestAPIVersion))
return nil
}
return fmt.Errorf("updating latest version: %w", err)