Fix image size calculation on upgrade (#508)

This commit is contained in:
Itxaka
2024-09-03 11:59:33 +02:00
committed by GitHub
parent eac394da0f
commit 4401cedb80
2 changed files with 8 additions and 6 deletions

View File

@@ -346,13 +346,15 @@ func NewUpgradeSpec(cfg *Config) (*v1.UpgradeSpec, error) {
State: installState,
}
setUpgradeSourceSize(cfg, spec)
// Unmarshall the config into the spec first so the active/recovery gets filled properly from all sources
err = unmarshallFullSpec(cfg, "upgrade", spec)
if err != nil {
return nil, fmt.Errorf("failed unmarshalling the full spec: %w", err)
}
err = setUpgradeSourceSize(cfg, spec)
if err != nil {
return nil, fmt.Errorf("failed calculating size: %w", err)
}
return spec, nil
}
@@ -367,7 +369,7 @@ func setUpgradeSourceSize(cfg *Config, spec *v1.UpgradeSpec) error {
targetSpec = &(spec.Active)
}
if targetSpec.Source.IsEmpty() {
if targetSpec.Source != nil && targetSpec.Source.IsEmpty() {
return nil
}