diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 43e48676..cf9a6860 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -131,71 +131,6 @@ func (self *nodeYaml) FindAllNodes() ([]NodeInfo, error) { return ret, nil } -/* -func (self *nodeYaml) FindAllControllers() ([]ControllerConf, error) { - var ret []ControllerConf - - for controllername, controller := range self.Controllers { - var c ControllerConf - - c.Id = controllername - c.Ipaddr = controller.Ipaddr - c.Comment = controller.Comment - c.Fqdn = controller.Fqdn - - //TODO: Is there a better way to do this, cause EWWW! - c.Services = struct { - Warewulfd struct { - Port string - Secure bool - StartCmd string - RestartCmd string - EnableCmd string - } - Dhcp struct { - Enabled bool - Template string - RangeStart string - RangeEnd string - ConfigFile string - StartCmd string - RestartCmd string - EnableCmd string - } - Tftp struct { - Enabled bool - TftpRoot string - StartCmd string - RestartCmd string - EnableCmd string - } - Nfs struct { - Enabled bool - Exports []string - StartCmd string - RestartCmd string - EnableCmd string - } - }(controller.Services) - - // Validations // - - if c.Ipaddr == "" { - wwlog.Printf(wwlog.WARN, "Controller IP address is unset: %s\n", c.Id) - } - - if c.Services.Warewulfd.Port == "" { - c.Services.Warewulfd.Port = "987" - } - - // TODO: Validate or die on all inputs - - ret = append(ret, c) - } - return ret, nil -} -*/ - func (self *nodeYaml) FindAllProfiles() ([]NodeInfo, error) { var ret []NodeInfo diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index 0435d439..54ad3c7f 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -11,15 +11,13 @@ import ( ******/ type nodeYaml struct { - Controllers map[string]*ControllerConf `yaml:"controlers"` NodeProfiles map[string]*NodeConf Nodes map[string]*NodeConf } type NodeConf struct { - Comment string `yaml:"comment,omitempty"` - Disabled bool `yaml:"disabled,omitempty"` - // Hostname string `yaml:"hostname,omitempty"` + Comment string `yaml:"comment,omitempty"` + Disabled bool `yaml:"disabled,omitempty"` DomainName string `yaml:"domain name,omitempty"` Vnfs string `yaml:"vnfs,omitempty"` Ipxe string `yaml:"ipxe template,omitempty"` @@ -35,45 +33,6 @@ type NodeConf struct { NetDevs map[string]*NetDevs `yaml:"network devices,omitempty"` } -type ControllerConf struct { - Comment string `yaml:"comment"` - Ipaddr string `yaml:"ipaddr"` - Fqdn string `yaml:"fqdn"` - Services struct { - Warewulfd struct { - Port string `yaml:"port"` - Secure bool `yaml:"secure,omitempty"` - StartCmd string `yaml:"start command,omitempty"` - RestartCmd string `yaml:"restart command,omitempty"` - EnableCmd string `yaml:"enable command,omitempty"` - } `yaml:"warewulf"` - Dhcp struct { - Enabled bool `yaml:"enabled,omitempty"` - Template string `yaml:"template,omitempty"` - RangeStart string `yaml:"range start,omitempty"` - RangeEnd string `yaml:"range end,omitempty"` - ConfigFile string `yaml:"config file,omitempty"` - StartCmd string `yaml:"start command,omitempty"` - RestartCmd string `yaml:"restart command,omitempty"` - EnableCmd string `yaml:"enable command,omitempty"` - } `yaml:"dhcp,omitempty"` - Tftp struct { - Enabled bool `yaml:"enabled,omitempty"` - TftpRoot string `yaml:"tftp root,omitempty"` - StartCmd string `yaml:"start command,omitempty"` - RestartCmd string `yaml:"restart command,omitempty"` - EnableCmd string `yaml:"enable command,omitempty"` - } `yaml:"tftp,omitempty"` - Nfs struct { - Enabled bool `yaml:"enabled,omitempty"` - Exports []string `yaml:"exports,omitempty"` - StartCmd string `yaml:"start command,omitempty"` - RestartCmd string `yaml:"restart command,omitempty"` - EnableCmd string `yaml:"enable command,omitempty"` - } `yaml:"nfs,omitempty"` - } `yaml:"services"` -} - type NetDevs struct { Type string `yaml:"type,omitempty"` Default bool `yaml:"default"` @@ -97,11 +56,9 @@ type Entry struct { } type NodeInfo struct { - Id Entry - Cid Entry - Comment Entry - // HostName Entry - // Fqdn Entry + Id Entry + Cid Entry + Comment Entry DomainName Entry Vnfs Entry Ipxe Entry diff --git a/internal/pkg/node/methods.go b/internal/pkg/node/methods.go index 1ea3b766..caa221f7 100644 --- a/internal/pkg/node/methods.go +++ b/internal/pkg/node/methods.go @@ -108,8 +108,8 @@ func (self *Entry) Print() string { func (self *Entry) Source() string { if self.value != "" && self.altvalue != "" { - return "OVERRIDDEN" - //return fmt.Sprintf("(%s)", self.from) + return "SUPERSEDED" + //return fmt.Sprintf("[%s]", self.from) } else if self.from == "" { return "--" } @@ -120,5 +120,11 @@ func (self *Entry) Defined() bool { if self.value != "" { return true } + if self.altvalue != "" { + return true + } + if self.def != "" { + return true + } return false } diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index f82431c0..6b9fa751 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -153,60 +153,6 @@ func (self *nodeYaml) ProfileUpdate(profile NodeInfo) error { return nil } -/* - - -func (self *nodeYaml) AddProfile(profileID string) error { - var profile ProfileConf - - wwlog.Printf(wwlog.VERBOSE, "Adding new profile: %s/%s\n", profileID) - - if _, ok := self.NodeProfiles[profileID]; ok { - return errors.New("Profile name already exists: " + profileID) - } - - self.NodeProfiles[profileID] = &profile - - return nil -} - -func (self *nodeYaml) DelProfile(profileID string) error { - if _, ok := self.NodeProfiles[profileID]; !ok { - return errors.New("Group '" + profileID + "' was not found") - } - - wwlog.Printf(wwlog.VERBOSE, "Deleting profile: %s\n", profileID) - delete(self.NodeProfiles, profileID) - - return nil -} - -func (self *nodeYaml) ProfileUpdate(profile ProfileInfo) error { - profileID := profile.Id - - if _, ok := self.NodeProfiles[profileID]; !ok { - return errors.New("Group '" + profileID + "' was not found") - } - - self.NodeProfiles[profileID].DomainName = get2Set(profile.DomainName) - self.NodeProfiles[profileID].Vnfs = get2Set(profile.Vnfs) - self.NodeProfiles[profileID].Ipxe = get2Set(profile.Ipxe) - self.NodeProfiles[profileID].KernelVersion = get2Set(profile.KernelVersion) - self.NodeProfiles[profileID].IpmiNetmask = get2Set(profile.IpmiNetmask) - self.NodeProfiles[profileID].IpmiUserName = get2Set(profile.IpmiUserName) - self.NodeProfiles[profileID].IpmiPassword = get2Set(profile.IpmiPassword) - self.NodeProfiles[profileID].RuntimeOverlay = get2Set(profile.RuntimeOverlay) - self.NodeProfiles[profileID].SystemOverlay = get2Set(profile.SystemOverlay) - - return nil -} - - - - - -*/ - /**** * * PERSISTENCE