profile and node commands and DB all working as expected now

This commit is contained in:
Gregory Kurtzer
2020-12-03 13:49:49 -08:00
parent eaf6bb1196
commit 84bf9fbb43
14 changed files with 223 additions and 59 deletions

View File

@@ -2,9 +2,16 @@ nodeprofiles:
default:
comment: "Hello from the default profile"
vnfs: ""
kernel version: ""
kernel version: "blahblah"
kernel args: crashkernel=no quiet
network devices:
eth0:
type: ethernet
netmask: 255.255.255.0
gateway: 192.168.1.1
ipaddr: 192.168.1.99
test:
comment: "Test profile"
control:
localhost:
@@ -43,13 +50,12 @@ nodes:
n0000.cluster01:
profiles:
- default
netdevs:
network devices:
eth0:
type: ethernet
hwaddr: 00:0c:29:23:8b:48
ipaddr: 192.168.1.100
netmask: 255.255.255.0
gateway: 192.168.1.1
ib0:
type: infiniband
hwaddr: aa:bb:cc:dd:ee:a0
@@ -58,18 +64,17 @@ nodes:
n0001.cluster01:
profiles:
- default
netdevs:
- test
network devices:
eth0:
hwaddr: aa:bb:cc:dd:ee:b0
ipaddr: 192.168.1.101
netmask: 255.255.255.0
gateway: 192.168.1.1
ib0:
hwaddr: aa:bb:cc:dd:ee:b1
ipaddr: 192.168.10.100
netmask: 255.255.255.0
n0000.cluster02:
netdevs:
network devices:
eth0:
hwaddr: aa:bb:cc:dd:ee:c0
ipaddr: 192.168.2.100

1
go.mod
View File

@@ -44,6 +44,7 @@ require (
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/spf13/cobra v1.1.1
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/vbauerster/mpb/v5 v5.3.0 // indirect
go.etcd.io/bbolt v1.3.5 // indirect

2
go.sum
View File

@@ -384,6 +384,8 @@ github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eN
github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao=
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31 h1:OXcKh35JaYsGMRzpvFkLv/MEyPuL49CThT1pZ8aSml4=
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=

View File

@@ -61,12 +61,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Source(), node.IpmiUserName.Print())
for name, netdev := range node.NetDevs {
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Source(), netdev.Ipaddr.Get())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":NETMASK", netdev.Netmask.Source(), netdev.Netmask.Get())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":GATEWAY", netdev.Gateway.Source(), netdev.Gateway.Get())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Source(), netdev.Hwaddr.Get())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":TYPE", netdev.Type.Source(), netdev.Type.Get())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Source(), netdev.Hwaddr.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Source(), netdev.Ipaddr.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":NETMASK", netdev.Netmask.Source(), netdev.Netmask.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":GATEWAY", netdev.Gateway.Source(), netdev.Gateway.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":TYPE", netdev.Type.Source(), netdev.Type.Print())
}
// v := reflect.ValueOf(node)

View File

@@ -185,13 +185,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Printf(wwlog.ERROR, "You must include the '--netdev' option\n")
os.Exit(1)
}
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Deleting network device: %s\n", n.Id.Get(), SetNetDev)
if _, ok := n.NetDevs[SetNetDev]; !ok {
wwlog.Printf(wwlog.ERROR, "Network Device doesn't exist: %s\n", SetNetDev)
os.Exit(1)
}
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Deleting network device: %s\n", n.Id.Get(), SetNetDev)
delete(n.NetDevs, SetNetDev)
err := nodeDB.NodeUpdate(n)
if err != nil {
@@ -206,9 +207,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if _, ok := n.NetDevs[SetNetDev]; !ok {
wwlog.Printf(wwlog.ERROR, "Network Device doesn't exist: %s\n", SetNetDev)
os.Exit(1)
var nd node.NetDevEntry
n.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting Ipaddr to: %s\n", n.Id.Get(), SetNetDev, SetIpaddr)
n.NetDevs[SetNetDev].Ipaddr.Set(SetIpaddr)
@@ -225,9 +227,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if _, ok := n.NetDevs[SetNetDev]; !ok {
wwlog.Printf(wwlog.ERROR, "Network Device doesn't exist: %s\n", SetNetDev)
os.Exit(1)
var nd node.NetDevEntry
n.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting netmask to: %s\n", n.Id.Get(), SetNetDev, SetNetmask)
n.NetDevs[SetNetDev].Netmask.Set(SetNetmask)
@@ -244,9 +247,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if _, ok := n.NetDevs[SetNetDev]; !ok {
wwlog.Printf(wwlog.ERROR, "Network Device doesn't exist: %s\n", SetNetDev)
os.Exit(1)
var nd node.NetDevEntry
n.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting gateway to: %s\n", n.Id.Get(), SetNetDev, SetGateway)
n.NetDevs[SetNetDev].Gateway.Set(SetGateway)
@@ -263,9 +267,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if _, ok := n.NetDevs[SetNetDev]; !ok {
wwlog.Printf(wwlog.ERROR, "Network Device doesn't exist: %s\n", SetNetDev)
os.Exit(1)
var nd node.NetDevEntry
n.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting HW address to: %s\n", n.Id.Get(), SetNetDev, SetHwaddr)
n.NetDevs[SetNetDev].Hwaddr.Set(SetHwaddr)

View File

@@ -48,7 +48,7 @@ func init() {
baseCmd.PersistentFlags().StringSliceVarP(&SetAddProfile, "addprofile", "p", []string{}, "Add Profile(s) to node")
baseCmd.PersistentFlags().StringSliceVarP(&SetDelProfile, "delprofile", "r", []string{}, "Remove Profile(s) to node")
baseCmd.PersistentFlags().StringVarP(&SetNetDev, "netdev", "n", "eth0", "Define the network device to configure")
baseCmd.PersistentFlags().StringVarP(&SetNetDev, "netdev", "n", "", "Define the network device to configure")
baseCmd.PersistentFlags().StringVarP(&SetIpaddr, "ipaddr", "I", "", "Set the node's network device IP address")
baseCmd.PersistentFlags().StringVarP(&SetNetmask, "netmask", "M", "", "Set the node's network device netmask")
baseCmd.PersistentFlags().StringVarP(&SetGateway, "gateway", "G", "", "Set the node's network device gateway")

View File

@@ -6,6 +6,7 @@ import (
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"os"
"sort"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
@@ -22,6 +23,13 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
os.Exit(1)
}
sort.Slice(profiles, func(i, j int) bool {
if profiles[i].Id.Get() < profiles[j].Id.Get() {
return true
}
return false
})
for _, node := range profiles {
fmt.Printf("################################################################################\n")
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), "Id", node.Id.Print())
@@ -38,11 +46,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Print())
for name, netdev := range node.NetDevs {
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Get())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":NETMASK", netdev.Netmask.Get())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":GATEWAY", netdev.Gateway.Get())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Get())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":TYPE", netdev.Hwaddr.Get())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Print())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":NETMASK", netdev.Netmask.Print())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":GATEWAY", netdev.Gateway.Print())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Print())
fmt.Printf("%-20s %-18s: %s\n", node.Id.Get(), name+":TYPE", netdev.Hwaddr.Print())
}
}

View File

@@ -47,6 +47,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
for _, p := range profiles {
wwlog.Printf(wwlog.VERBOSE, "Modifying profile: %s\n", p.Id.Get())
if SetComment != "" {
wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting comment to: %s\n", p.Id, SetComment)
@@ -149,6 +150,107 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
}
if SetNetDevDel == true {
if SetNetDev == "" {
wwlog.Printf(wwlog.ERROR, "You must include the '--netdev' option\n")
os.Exit(1)
}
if _, ok := p.NetDevs[SetNetDev]; !ok {
wwlog.Printf(wwlog.ERROR, "Profile '%s': network Device doesn't exist: %s\n", p.Id.Get(), SetNetDev)
os.Exit(1)
}
wwlog.Printf(wwlog.VERBOSE, "Profile %s: Deleting network device: %s\n", p.Id.Get(), SetNetDev)
delete(p.NetDevs, SetNetDev)
err := nodeDB.ProfileUpdate(p)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
if SetIpaddr != "" {
if SetNetDev == "" {
wwlog.Printf(wwlog.ERROR, "You must include the '--netdev' option\n")
os.Exit(1)
}
if _, ok := p.NetDevs[SetNetDev]; !ok {
var nd node.NetDevEntry
p.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Profile '%s': Setting IP address to: %s:%s\n", p.Id.Get(), SetNetDev, SetHwaddr)
p.NetDevs[SetNetDev].Ipaddr.Set(SetIpaddr)
err := nodeDB.ProfileUpdate(p)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
if SetNetmask != "" {
if SetNetDev == "" {
wwlog.Printf(wwlog.ERROR, "You must include the '--netdev' option\n")
os.Exit(1)
}
if _, ok := p.NetDevs[SetNetDev]; !ok {
var nd node.NetDevEntry
p.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Profile '%s': Setting netmask to: %s:%s\n", p.Id.Get(), SetNetDev, SetHwaddr)
p.NetDevs[SetNetDev].Netmask.Set(SetNetmask)
err := nodeDB.ProfileUpdate(p)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
if SetGateway != "" {
if SetNetDev == "" {
wwlog.Printf(wwlog.ERROR, "You must include the '--netdev' option\n")
os.Exit(1)
}
if _, ok := p.NetDevs[SetNetDev]; !ok {
var nd node.NetDevEntry
p.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Profile '%s': Setting gateway to: %s:%s\n", p.Id.Get(), SetNetDev, SetHwaddr)
p.NetDevs[SetNetDev].Gateway.Set(SetGateway)
err := nodeDB.ProfileUpdate(p)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
if SetHwaddr != "" {
if SetNetDev == "" {
wwlog.Printf(wwlog.ERROR, "You must include the '--netdev' option\n")
os.Exit(1)
}
if _, ok := p.NetDevs[SetNetDev]; !ok {
var nd node.NetDevEntry
p.NetDevs[SetNetDev] = &nd
}
wwlog.Printf(wwlog.VERBOSE, "Profile '%s': Setting HW address to: %s:%s\n", p.Id.Get(), SetNetDev, SetHwaddr)
p.NetDevs[SetNetDev].Hwaddr.Set(SetHwaddr)
err := nodeDB.ProfileUpdate(p)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
}
if len(profiles) > 0 {

View File

@@ -20,6 +20,12 @@ var (
SetIpmiNetmask string
SetIpmiUsername string
SetIpmiPassword string
SetNetDev string
SetIpaddr string
SetNetmask string
SetGateway string
SetHwaddr string
SetNetDevDel bool
)
func init() {
@@ -34,6 +40,13 @@ func init() {
baseCmd.PersistentFlags().StringVar(&SetIpmiUsername, "ipmiuser", "", "Set the node's IPMI username")
baseCmd.PersistentFlags().StringVar(&SetIpmiPassword, "ipmipass", "", "Set the node's IPMI password")
baseCmd.PersistentFlags().StringVarP(&SetNetDev, "netdev", "n", "", "Define the network device to configure")
baseCmd.PersistentFlags().StringVarP(&SetIpaddr, "ipaddr", "I", "", "Set the node's network device IP address")
baseCmd.PersistentFlags().StringVarP(&SetNetmask, "netmask", "M", "", "Set the node's network device netmask")
baseCmd.PersistentFlags().StringVarP(&SetGateway, "gateway", "G", "", "Set the node's network device gateway")
baseCmd.PersistentFlags().StringVarP(&SetHwaddr, "hwaddr", "H", "", "Set the node's network device HW address")
baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device")
baseCmd.PersistentFlags().BoolVarP(&SetAll, "all", "a", false, "Set all profiles")
}

View File

@@ -36,7 +36,7 @@ func init() {
rootCmd.AddCommand(kernel.GetCommand())
// rootCmd.AddCommand(group.GetCommand())
rootCmd.AddCommand(profile.GetCommand())
// rootCmd.AddCommand(service.GetCommand())
//rootCmd.AddCommand(service.GetCommand())
rootCmd.AddCommand(ready.GetCommand())
}

View File

@@ -10,6 +10,8 @@ import (
"strings"
)
const ConfigFile = "/etc/warewulf/nodes.conf"
func New() (nodeYaml, error) {
var ret nodeYaml
@@ -20,28 +22,33 @@ func New() (nodeYaml, error) {
return ret, err
}
wwlog.Printf(wwlog.DEBUG, "Unmarshaling the node configuration\n")
err = yaml.Unmarshal(data, &ret)
if err != nil {
return ret, err
}
wwlog.Printf(wwlog.DEBUG, "Returning node object\n")
return ret, nil
}
func (self *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
var ret []NodeInfo
wwlog.Printf(wwlog.DEBUG, "Finding all nodes...\n")
for nodename, node := range self.Nodes {
var n NodeInfo
wwlog.Printf(wwlog.DEBUG, "In node loop: %s\n", nodename)
n.NetDevs = make(map[string]*NetDevEntry)
n.SystemOverlay.Set("default")
n.RuntimeOverlay.Set("default")
n.Ipxe.Set("default")
n.SystemOverlay.SetDefault("default")
n.RuntimeOverlay.SetDefault("default")
n.Ipxe.SetDefault("default")
fullname := strings.SplitN(nodename, ".", 2)
if len(fullname) > 1 {
n.DomainName.Set(fullname[1])
n.DomainName.SetDefault(fullname[1])
}
if len(node.Profiles) == 0 {
@@ -106,6 +113,7 @@ func (self *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
var netdev NetDevEntry
n.NetDevs[devname] = &netdev
}
wwlog.Printf(wwlog.DEBUG, "Updating profile (%s) netdev: %s\n", p, devname)
n.NetDevs[devname].Ipaddr.SetAlt(netdev.Ipaddr, pstring)
n.NetDevs[devname].Netmask.SetAlt(netdev.Netmask, pstring)
@@ -193,6 +201,7 @@ func (self *nodeYaml) FindAllProfiles() ([]NodeInfo, error) {
for name, profile := range self.NodeProfiles {
var p NodeInfo
p.NetDevs = make(map[string]*NetDevEntry)
p.Id.Set(name)
p.Comment.Set(profile.Comment)
@@ -212,6 +221,8 @@ func (self *nodeYaml) FindAllProfiles() ([]NodeInfo, error) {
p.NetDevs[devname] = &netdev
}
wwlog.Printf(wwlog.DEBUG, "Updating profile netdev: %s\n", devname)
p.NetDevs[devname].Ipaddr.Set(netdev.Ipaddr)
p.NetDevs[devname].Netmask.Set(netdev.Netmask)
p.NetDevs[devname].Hwaddr.Set(netdev.Hwaddr)

View File

@@ -20,19 +20,19 @@ type NodeConf struct {
Comment string `yaml:"comment,omitempty"`
Disabled bool `yaml:"disabled,omitempty"`
// Hostname string `yaml:"hostname,omitempty"`
DomainName string `yaml:"domain name,omitempty"`
Vnfs string `yaml:"vnfs,omitempty"`
Ipxe string `yaml:"ipxe template,omitempty"`
KernelVersion string `yaml:"kernel version,omitempty"`
KernelArgs string `yaml:"kernel args,omitempty"`
IpmiUserName string `yaml:"ipmi username,omitempty"`
IpmiPassword string `yaml:"ipmi password,omitempty"`
IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"`
IpmiNetmask string `yaml:"ipmi netmask,omitempty"`
RuntimeOverlay string `yaml:"runtime overlay files,omitempty"`
SystemOverlay string `yaml:"system overlay files,omitempty"`
Profiles []string `yaml:"profiles,omitempty"`
NetDevs map[string]*NetDevs
DomainName string `yaml:"domain name,omitempty"`
Vnfs string `yaml:"vnfs,omitempty"`
Ipxe string `yaml:"ipxe template,omitempty"`
KernelVersion string `yaml:"kernel version,omitempty"`
KernelArgs string `yaml:"kernel args,omitempty"`
IpmiUserName string `yaml:"ipmi username,omitempty"`
IpmiPassword string `yaml:"ipmi password,omitempty"`
IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"`
IpmiNetmask string `yaml:"ipmi netmask,omitempty"`
RuntimeOverlay string `yaml:"runtime overlay files,omitempty"`
SystemOverlay string `yaml:"system overlay files,omitempty"`
Profiles []string `yaml:"profiles,omitempty"`
NetDevs map[string]*NetDevs `yaml:"network devices,omitempty"`
}
type ControllerConf struct {
@@ -93,6 +93,7 @@ type Entry struct {
bool bool
altbool bool
from string
def string
}
type NodeInfo struct {
@@ -126,8 +127,6 @@ type NetDevEntry struct {
Gateway Entry `yaml:"gateway,omitempty"`
}
const ConfigFile = "/etc/warewulf/nodes.conf"
func init() {
//TODO: Check to make sure nodes.conf is found
if util.IsFile(ConfigFile) == false {

View File

@@ -1,6 +1,8 @@
package node
import "strings"
import (
"strings"
)
/**********
*
@@ -44,6 +46,16 @@ func (self *Entry) SetAltB(val bool, from string) {
return
}
func (self *Entry) SetDefault(val string) {
if val == "" {
return
}
self.def = val
return
}
/**********
*
* Gets
@@ -57,6 +69,9 @@ func (self *Entry) Get() string {
if self.altvalue != "" {
return self.altvalue
}
if self.def != "" {
return self.def
}
return ""
}
@@ -85,11 +100,17 @@ func (self *Entry) Print() string {
if self.altvalue != "" {
return self.altvalue
}
if self.def != "" {
return self.def
}
return "--"
}
func (self *Entry) Source() string {
if self.from == "" {
if self.value != "" && self.altvalue != "" {
return "OVERRIDDEN"
//return fmt.Sprintf("(%s)", self.from)
} else if self.from == "" {
return "--"
}
return self.from

View File

@@ -66,12 +66,11 @@ func (self *nodeYaml) NodeUpdate(node NodeInfo) error {
self.Nodes[nodeID].RuntimeOverlay = node.RuntimeOverlay.GetReal()
self.Nodes[nodeID].SystemOverlay = node.SystemOverlay.GetReal()
self.Nodes[nodeID].Profiles = node.Profiles
self.Nodes[nodeID].NetDevs = make(map[string]*NetDevs)
for devname, netdev := range node.NetDevs {
if _, ok := self.Nodes[nodeID].NetDevs[devname]; !ok {
var netdev NetDevs
self.Nodes[nodeID].NetDevs[devname] = &netdev
}
var newdev NetDevs
self.Nodes[nodeID].NetDevs[devname] = &newdev
self.Nodes[nodeID].NetDevs[devname].Ipaddr = netdev.Ipaddr.GetReal()
self.Nodes[nodeID].NetDevs[devname].Netmask = netdev.Netmask.GetReal()
@@ -137,12 +136,11 @@ func (self *nodeYaml) ProfileUpdate(profile NodeInfo) error {
self.NodeProfiles[profileID].RuntimeOverlay = profile.RuntimeOverlay.GetReal()
self.NodeProfiles[profileID].SystemOverlay = profile.SystemOverlay.GetReal()
self.NodeProfiles[profileID].Profiles = profile.Profiles
self.NodeProfiles[profileID].NetDevs = make(map[string]*NetDevs)
for devname, netdev := range profile.NetDevs {
if _, ok := self.NodeProfiles[profileID].NetDevs[devname]; !ok {
var netdev NetDevs
self.NodeProfiles[profileID].NetDevs[devname] = &netdev
}
var newdev NetDevs
self.NodeProfiles[profileID].NetDevs[devname] = &newdev
self.NodeProfiles[profileID].NetDevs[devname].Ipaddr = netdev.Ipaddr.GetReal()
self.NodeProfiles[profileID].NetDevs[devname].Netmask = netdev.Netmask.GetReal()