Cleanups and minor fixups

This commit is contained in:
Gregory Kurtzer
2020-12-13 22:45:08 -08:00
parent 487f45f7a9
commit 62a1abaab3
16 changed files with 73 additions and 44 deletions

View File

@@ -102,6 +102,17 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
}
if SetDiscoverable == true {
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting node to discoverable\n", n.Id.Get())
n.Discoverable.SetB(true)
err := nodeDB.NodeUpdate(n)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
}
nodeDB.Persist()

View File

@@ -10,13 +10,14 @@ var (
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
}
SetGroup string
SetController string
SetNetDev string
SetIpaddr string
SetNetmask string
SetGateway string
SetHwaddr string
SetGroup string
SetController string
SetNetDev string
SetIpaddr string
SetNetmask string
SetGateway string
SetHwaddr string
SetDiscoverable bool
)
func init() {
@@ -27,6 +28,7 @@ func init() {
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(&SetDiscoverable, "discoverable", false, "Make this node discoverable")
}