Fix a null-pointer bug in wwctl upgrade config

Also removing some vestigial development-debug output.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-01-19 00:35:34 -07:00
parent 2408555748
commit 22657fed36
2 changed files with 1 additions and 3 deletions

View File

@@ -176,7 +176,7 @@ func (this *NFSExportConf) Upgrade() (upgraded *config.NFSExportConf) {
upgraded = new(config.NFSExportConf)
upgraded.Path = this.Path
upgraded.ExportOptions = this.ExportOptions
if *(this.Mount) {
if this.Mount != nil && *(this.Mount) {
wwlog.Warn("Legacy mount configured for NFS export %s: use `wwctl upgrade nodes --with-warewulfconf=<original file>` to port to nodes.conf", this.Path)
}
return upgraded

View File

@@ -97,7 +97,6 @@ func (this *NodesYaml) Upgrade(addDefaults bool, replaceOverlays bool, warewulfc
if warewulfconf != nil && warewulfconf.NFS != nil {
var fstab []map[string]string
for _, export := range warewulfconf.NFS.Exports {
fmt.Printf("PORTING EXPORT: %s\n", export)
fstab = append(fstab, map[string]string{
"spec": fmt.Sprintf("warewulf:%s", export),
"file": export,
@@ -117,7 +116,6 @@ func (this *NodesYaml) Upgrade(addDefaults bool, replaceOverlays bool, warewulfc
fstab = append(fstab, entry)
}
}
fmt.Printf("FSTAB: %+v\n", fstab)
if len(fstab) > 0 {
if _, ok := upgraded.NodeProfiles["default"]; !ok {
upgraded.NodeProfiles["default"] = new(node.Profile)