Allow --discoverable option to be set via profiles (ref: #159)

This commit is contained in:
Gregory Kurtzer
2021-10-01 00:05:41 -07:00
parent 604dd2026f
commit cb1455bd8b
3 changed files with 17 additions and 0 deletions

View File

@@ -120,6 +120,16 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
p.IpmiInterface.Set(SetIpmiInterface)
}
if SetDiscoverable {
wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting all nodes to discoverable\n", p.Id.Get())
p.Discoverable.SetB(true)
}
if SetUndiscoverable {
wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting all nodes to undiscoverable\n", p.Id.Get())
p.Discoverable.SetB(false)
}
if SetNetDevDel {
if SetNetDev == "" {
wwlog.Printf(wwlog.ERROR, "You must include the '--netdev' option\n")

View File

@@ -56,6 +56,8 @@ var (
SetType string
SetNetDevDel bool
SetNetDevDefault bool
SetDiscoverable bool
SetUndiscoverable bool
SetInit string
SetRoot string
SetKey string
@@ -123,6 +125,8 @@ func init() {
baseCmd.PersistentFlags().BoolVarP(&SetAll, "all", "a", false, "Set all profiles")
baseCmd.PersistentFlags().BoolVarP(&SetForce, "force", "f", false, "Force configuration (even on error)")
baseCmd.PersistentFlags().BoolVarP(&SetYes, "yes", "y", false, "Set 'yes' to all questions asked")
baseCmd.PersistentFlags().BoolVar(&SetDiscoverable, "discoverable", false, "Make this node discoverable")
baseCmd.PersistentFlags().BoolVar(&SetUndiscoverable, "undiscoverable", false, "Remove the discoverable flag")
}
// GetRootCommand returns the root cobra.Command for the application.

View File

@@ -130,6 +130,9 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
n.IpmiInterface.SetAlt(config.NodeProfiles[p].IpmiInterface, p)
n.SystemOverlay.SetAlt(config.NodeProfiles[p].SystemOverlay, p)
n.RuntimeOverlay.SetAlt(config.NodeProfiles[p].RuntimeOverlay, p)
n.Discoverable.SetAltB(config.NodeProfiles[p].Discoverable, p)
n.Root.SetAlt(config.NodeProfiles[p].Root, p)
for devname, netdev := range config.NodeProfiles[p].NetDevs {