diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 48f11d0c..a2fb9d4a 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -48,7 +48,7 @@ func init() { } /* -Creates a new nodeDb object from the actual configuration +Creates a new nodeDb object from the on-disk configuration */ func New() (NodeYaml, error) { wwlog.Verbose("Opening node configuration file: %s", ConfigFile) @@ -60,6 +60,10 @@ func New() (NodeYaml, error) { } +// Parse constructs a new nodeDb object from an input YAML +// document. Passes any errors return from yaml.Unmarshal. Returns an +// error if any parsed value is not of a valid type for the given +// parameter. func Parse(data []byte) (NodeYaml, error) { var ret NodeYaml var err error diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index 8513b5ed..8f2081d7 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -135,6 +135,8 @@ func (config *NodeYaml) Persist() error { } +// Dump returns a YAML document representing the nodeDb +// instance. Passes through any errors generated by yaml.Marshal. func (config *NodeYaml) Dump() ([]byte, error) { // flatten out profiles and nodes for _, val := range config.NodeProfiles {