mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
config: only fetch TCB values from api if wanted
If no TCB value is set to `latest`, the fetcher is now no longer called.
This commit is contained in:
parent
67348792dc
commit
257eb5370f
@ -63,9 +63,14 @@ func (c AWSSEVSNP) EqualTo(other AttestationCfg) (bool, error) {
|
||||
|
||||
// FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them.
|
||||
func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error {
|
||||
// Only talk to the API if at least one version number is set to latest.
|
||||
if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
|
||||
return nil
|
||||
}
|
||||
|
||||
versions, err := fetcher.FetchSEVSNPVersionLatest(ctx, variant.AWSSEVSNP{})
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("fetching latest TCB versions from configapi: %w", err)
|
||||
}
|
||||
// set number and keep isLatest flag
|
||||
c.mergeWithLatestVersion(versions.SEVSNPVersion)
|
||||
|
@ -69,9 +69,14 @@ func (c AzureSEVSNP) EqualTo(old AttestationCfg) (bool, error) {
|
||||
|
||||
// FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them.
|
||||
func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error {
|
||||
// Only talk to the API if at least one version number is set to latest.
|
||||
if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
|
||||
return nil
|
||||
}
|
||||
|
||||
versions, err := fetcher.FetchSEVSNPVersionLatest(ctx, variant.AzureSEVSNP{})
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("fetching latest TCB versions from configapi: %w", err)
|
||||
}
|
||||
// set number and keep isLatest flag
|
||||
c.mergeWithLatestVersion(versions.SEVSNPVersion)
|
||||
|
Loading…
Reference in New Issue
Block a user