Merge pull request #162 from gmkurtzer/profile_discoverable

Allow `--discoverable` option to be set via profiles
This commit is contained in:
Gregory M. Kurtzer
2021-10-01 00:09:05 -07:00
committed by GitHub
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 {