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, 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) err = unmarshallFullSpec(cfg, "upgrade", spec)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed unmarshalling the full spec: %w", err) 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 return spec, nil
} }
@@ -367,7 +369,7 @@ func setUpgradeSourceSize(cfg *Config, spec *v1.UpgradeSpec) error {
targetSpec = &(spec.Active) targetSpec = &(spec.Active)
} }
if targetSpec.Source.IsEmpty() { if targetSpec.Source != nil && targetSpec.Source.IsEmpty() {
return nil return nil
} }

View File

@@ -484,9 +484,9 @@ reset:
upgrade: upgrade:
recovery: true recovery: true
system: system:
uri: docker:test/image:latest uri: oci:busybox
recovery-system: recovery-system:
uri: docker:test/image:latest uri: oci:busybox
cloud-init-paths: cloud-init-paths:
- /what - /what
`) `)