be more verbose

This commit is contained in:
Christian Goll
2022-04-12 17:59:22 +02:00
parent 944dc9f126
commit 2f2580e81b
3 changed files with 26 additions and 23 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"reflect"
"github.com/hpcng/warewulf/cmd/update_configuration/vers42"
"github.com/hpcng/warewulf/cmd/update_configuration/vers43"
@@ -16,6 +17,8 @@ import (
var nowrite bool
var confFile string
const actvers int = 43
type nodeVersionOnly struct {
WWInternal int `yaml:"WW_INTERNAL"`
}
@@ -39,6 +42,7 @@ func saveConf(conf interface{}) {
fmt.Printf("Could not get file mode: %s\n", err)
os.Exit(1)
}
fmt.Printf("writing configuration file %s as type %s\n", confFile, reflect.TypeOf(conf))
err = ioutil.WriteFile(confFile, out, info.Mode())
if err != nil {
fmt.Printf("Could not write file: %s\n", err)
@@ -72,17 +76,19 @@ func main() {
fmt.Printf("Could open file %v\n", err)
os.Exit(1)
}
if startVers == 0 {
var getConf nodeVersionOnly
fmt.Printf("Unmarshaling the node configuration\n")
err = yaml.Unmarshal(data, &getConf)
if err != nil {
fmt.Printf("Could not unmarshall: %v\n", err)
}
fmt.Printf("Got version %v in %s\n", getConf.WWInternal, confFile)
if getConf.WWInternal == 0 {
startVers = 42
}
var getConf nodeVersionOnly
fmt.Printf("Unmarshaling the node configuration\n")
err = yaml.Unmarshal(data, &getConf)
if err != nil {
fmt.Printf("Could not unmarshall: %v\n", err)
}
fmt.Printf("Got version %v in %s\n", getConf.WWInternal, confFile)
if getConf.WWInternal == actvers {
fmt.Printf("On actual version, bailing out\n")
os.Exit(0)
}
if startVers == 0 && getConf.WWInternal == 0 {
startVers = 42
}
var conf42 vers42.NodeYaml
conf42.NodeProfiles = make(map[string]*vers42.NodeConf)

View File

@@ -1,16 +1,12 @@
nodeprofiles:
default:
comment: This profile is automatically included for each node
runtime overlay:
- generic
discoverable: "false"
runtime overlay: "generic"
discoverable: false
leap:
comment: openSUSE leap
kernel:
override: 5.14.21
ipmi:
netmask: 255.255.255.0
discoverable: "false"
kernel version: "5.14.21"
ipmi netmask: "255.255.255.0"
keys:
foo: baar
network devices:
@@ -18,10 +14,9 @@ nodeprofiles:
gateway: 1.1.1.1
nodes:
node01:
system overlay:
- nodeover
discoverable: "true"
system overlay: "nodeoverlay"
discoverable: true
network devices:
eth0:
ipaddr: 1.2.3.4
default: "true"
default: true