Only write to IPMI if this is explictly wanted
This commit is contained in:
@@ -136,6 +136,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
n.IpmiInterface.Set(SetIpmiInterface)
|
||||
}
|
||||
|
||||
if SetIpmiWrite == "yes" || SetNetOnBoot == "y" || SetNetOnBoot == "1" || SetNetOnBoot == "true" {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting Ipmiwrite\n", n.Id.Get(), SetIpmiWrite)
|
||||
n.IpmiWrite.SetB(true)
|
||||
} else {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting Ipmiwrite \n", n.Id.Get(), SetIpmiWrite)
|
||||
n.IpmiWrite.SetB(false)
|
||||
}
|
||||
|
||||
if SetDiscoverable {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting node to discoverable\n", n.Id.Get())
|
||||
n.Discoverable.SetB(true)
|
||||
|
||||
@@ -58,6 +58,7 @@ var (
|
||||
SetIpmiUsername string
|
||||
SetIpmiPassword string
|
||||
SetIpmiInterface string
|
||||
SetIpmiWrite string
|
||||
SetNodeAll bool
|
||||
SetYes bool
|
||||
SetProfile string
|
||||
@@ -117,6 +118,7 @@ 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().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults: 'lan')")
|
||||
baseCmd.PersistentFlags().StringVar(&SetIpmiWrite, "ipmiwrite", "", "Enable/disable the write of impi configuration (yes/no)")
|
||||
baseCmd.PersistentFlags().StringSliceVar(&SetAddProfile, "addprofile", []string{}, "Add Profile(s) to node")
|
||||
baseCmd.PersistentFlags().StringSliceVar(&SetDelProfile, "delprofile", []string{}, "Remove Profile(s) to node")
|
||||
baseCmd.PersistentFlags().StringVarP(&SetProfile, "profile", "P", "", "Set the node's profile members (comma separated)")
|
||||
|
||||
@@ -130,6 +130,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
p.IpmiInterface.Set(SetIpmiInterface)
|
||||
}
|
||||
|
||||
if SetIpmiWrite == "yes" || SetNetOnBoot == "y" || SetNetOnBoot == "1" || SetNetOnBoot == "true" {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting Ipmiwrite\n", p.Id.Get(), SetIpmiWrite)
|
||||
p.IpmiWrite.SetB(true)
|
||||
} else {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting Ipmiwrite \n", p.Id.Get(), SetIpmiWrite)
|
||||
p.IpmiWrite.SetB(false)
|
||||
}
|
||||
|
||||
if SetDiscoverable {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting all nodes to discoverable\n", p.Id.Get())
|
||||
p.Discoverable.SetB(true)
|
||||
|
||||
@@ -50,6 +50,7 @@ var (
|
||||
SetIpmiUsername string
|
||||
SetIpmiPassword string
|
||||
SetIpmiInterface string
|
||||
SetIpmiWrite string
|
||||
SetNetName string
|
||||
SetNetDev string
|
||||
SetNetmask string
|
||||
@@ -111,6 +112,7 @@ 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().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults to 'lan')")
|
||||
baseCmd.PersistentFlags().StringVar(&SetIpmiWrite, "ipmiwrite", "", "Enable/disable the write of impi configuration (yes/no)")
|
||||
|
||||
baseCmd.PersistentFlags().StringVarP(&SetNetName, "netname", "n", "default", "Define the network name to configure")
|
||||
baseCmd.PersistentFlags().StringVarP(&SetNetDev, "netdev", "N", "", "Set the node's network device")
|
||||
|
||||
@@ -83,6 +83,7 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
|
||||
n.IpmiUserName.Set(node.IpmiUserName)
|
||||
n.IpmiPassword.Set(node.IpmiPassword)
|
||||
n.IpmiInterface.Set(node.IpmiInterface)
|
||||
n.IpmiWrite.SetB(node.IpmiWrite)
|
||||
n.SystemOverlay.Set(node.SystemOverlay)
|
||||
n.RuntimeOverlay.Set(node.RuntimeOverlay)
|
||||
n.Root.Set(node.Root)
|
||||
@@ -152,6 +153,7 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
|
||||
n.IpmiUserName.SetAlt(config.NodeProfiles[p].IpmiUserName, p)
|
||||
n.IpmiPassword.SetAlt(config.NodeProfiles[p].IpmiPassword, p)
|
||||
n.IpmiInterface.SetAlt(config.NodeProfiles[p].IpmiInterface, p)
|
||||
n.IpmiWrite.SetB(config.NodeProfiles[p].IpmiWrite)
|
||||
n.SystemOverlay.SetAlt(config.NodeProfiles[p].SystemOverlay, p)
|
||||
n.RuntimeOverlay.SetAlt(config.NodeProfiles[p].RuntimeOverlay, p)
|
||||
n.Root.SetAlt(config.NodeProfiles[p].Root, p)
|
||||
@@ -238,6 +240,7 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) {
|
||||
p.IpmiUserName.Set(profile.IpmiUserName)
|
||||
p.IpmiPassword.Set(profile.IpmiPassword)
|
||||
p.IpmiInterface.Set(profile.IpmiInterface)
|
||||
p.IpmiWrite.SetB(profile.IpmiWrite)
|
||||
p.RuntimeOverlay.Set(profile.RuntimeOverlay)
|
||||
p.SystemOverlay.Set(profile.SystemOverlay)
|
||||
p.Root.Set(profile.Root)
|
||||
|
||||
@@ -29,6 +29,7 @@ type NodeConf struct {
|
||||
IpmiPort string `yaml:"ipmi port,omitempty"`
|
||||
IpmiGateway string `yaml:"ipmi gateway,omitempty"`
|
||||
IpmiInterface string `yaml:"ipmi interface,omitempty"`
|
||||
IpmiWrite bool `yaml:"ipmi write,omitempty"`
|
||||
RuntimeOverlay string `yaml:"runtime overlay,omitempty"`
|
||||
SystemOverlay string `yaml:"system overlay,omitempty"`
|
||||
Init string `yaml:"init,omitempty"`
|
||||
@@ -81,6 +82,7 @@ type NodeInfo struct {
|
||||
IpmiUserName Entry
|
||||
IpmiPassword Entry
|
||||
IpmiInterface Entry
|
||||
IpmiWrite Entry
|
||||
RuntimeOverlay Entry
|
||||
SystemOverlay Entry
|
||||
Root Entry
|
||||
|
||||
@@ -69,6 +69,7 @@ func (config *nodeYaml) NodeUpdate(node NodeInfo) error {
|
||||
config.Nodes[nodeID].IpmiUserName = node.IpmiUserName.GetReal()
|
||||
config.Nodes[nodeID].IpmiPassword = node.IpmiPassword.GetReal()
|
||||
config.Nodes[nodeID].IpmiInterface = node.IpmiInterface.GetReal()
|
||||
config.Nodes[nodeID].IpmiWrite = node.IpmiWrite.GetB()
|
||||
config.Nodes[nodeID].RuntimeOverlay = node.RuntimeOverlay.GetReal()
|
||||
config.Nodes[nodeID].SystemOverlay = node.SystemOverlay.GetReal()
|
||||
config.Nodes[nodeID].Root = node.Root.GetReal()
|
||||
@@ -157,6 +158,7 @@ func (config *nodeYaml) ProfileUpdate(profile NodeInfo) error {
|
||||
config.NodeProfiles[profileID].IpmiUserName = profile.IpmiUserName.GetReal()
|
||||
config.NodeProfiles[profileID].IpmiPassword = profile.IpmiPassword.GetReal()
|
||||
config.NodeProfiles[profileID].IpmiInterface = profile.IpmiInterface.GetReal()
|
||||
config.NodeProfiles[profileID].IpmiWrite = profile.IpmiInterface.GetB()
|
||||
config.NodeProfiles[profileID].RuntimeOverlay = profile.RuntimeOverlay.GetReal()
|
||||
config.NodeProfiles[profileID].SystemOverlay = profile.SystemOverlay.GetReal()
|
||||
config.NodeProfiles[profileID].Root = profile.Root.GetReal()
|
||||
|
||||
@@ -181,6 +181,7 @@ func BuildOverlay(nodeInfo node.NodeInfo, overlayName string) error {
|
||||
tstruct.IpmiUserName = nodeInfo.IpmiUserName.Get()
|
||||
tstruct.IpmiPassword = nodeInfo.IpmiPassword.Get()
|
||||
tstruct.IpmiInterface = nodeInfo.IpmiInterface.Get()
|
||||
tstruct.IpmiWrite = nodeInfo.IpmiWrite.Get()
|
||||
tstruct.RuntimeOverlay = nodeInfo.RuntimeOverlay.Get()
|
||||
tstruct.SystemOverlay = nodeInfo.SystemOverlay.Get()
|
||||
tstruct.NetDevs = make(map[string]*node.NetDevs)
|
||||
|
||||
@@ -7,3 +7,4 @@ WWIPMI_NETMASK="{{$.IpmiNetmask}}"
|
||||
WWIPMI_GATEWAY="{{$.IpmiGateway}}"
|
||||
WWIPMI_USER="{{$.IpmiUserName}}"
|
||||
WWIPMI_PASSWORD="{{$.IpmiPassword}}"
|
||||
WWIPMI_WRITE="{{.$IpmiWrite}}
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
if [ "$WWIPMI_WRITE" == "false" ]; then
|
||||
echo "No write to IMPI configured"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -z "$WWIPMI_IPADDR" ]; then
|
||||
echo "No IPMI IP address supplied, skipping IPMI configuration"
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user