diff --git a/pkg/action/upgrade_test.go b/pkg/action/upgrade_test.go index 7ebc13e..a01fd71 100644 --- a/pkg/action/upgrade_test.go +++ b/pkg/action/upgrade_test.go @@ -19,10 +19,11 @@ package action_test import ( "bytes" "fmt" - agentConfig "github.com/kairos-io/kairos-agent/v2/pkg/config" - "github.com/kairos-io/kairos-agent/v2/pkg/utils/fs" "path/filepath" + agentConfig "github.com/kairos-io/kairos-agent/v2/pkg/config" + fsutils "github.com/kairos-io/kairos-agent/v2/pkg/utils/fs" + "github.com/jaypipes/ghw/pkg/block" "github.com/kairos-io/kairos-agent/v2/pkg/action" "github.com/kairos-io/kairos-agent/v2/pkg/constants" diff --git a/pkg/config/spec.go b/pkg/config/spec.go index 6d7f49f..b8af902 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -577,6 +577,11 @@ func ReadSpecFromCloudConfig(r *Config, spec string) (v1.Spec, error) { return nil, fmt.Errorf("failed initializing spec: %v", err) } + err = sp.Sanitize() + if err != nil { + return sp, fmt.Errorf("sanitizing the %s spec: %w", spec, err) + } + r.Logger.Debugf("Loaded %s spec: %s", spec, litter.Sdump(sp)) return sp, nil } @@ -738,10 +743,5 @@ func unmarshallFullSpec(r *Config, subkey string, sp v1.Spec) error { return fmt.Errorf("error unmarshalling %s Spec: %w", subkey, err) } - err = sp.Sanitize() - if err != nil { - return fmt.Errorf("sanitizing the % spec: %w", subkey, err) - } - return nil }