mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-08-01 16:17:52 +00:00
Run sanitization outside the spec building functions
To limit responsibility or those functions and to keep the tests passing (because they assumed no sanitization) Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
parent
d1e84c186c
commit
80f83ba676
@ -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"
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user