mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-25 05:09:47 +00:00
Fix image size calculation on upgrade (#508)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user