wwctl commands without NodeInfo
mostly remove Get and calls for the id Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
committed by
Jonathon Anderson
parent
28a7b9fe84
commit
457c7c16b1
@@ -18,17 +18,17 @@ type variables struct {
|
||||
setNodeAll bool
|
||||
setYes bool
|
||||
setForce bool
|
||||
netName string
|
||||
partName string
|
||||
diskName string
|
||||
fsName string
|
||||
profileConf node.NodeConf
|
||||
converters []func() error
|
||||
profileDel node.NodeConfDel
|
||||
profileAdd node.NodeConfAdd
|
||||
}
|
||||
|
||||
func GetCommand() *cobra.Command {
|
||||
vars := variables{}
|
||||
vars.profileConf = node.NewConf()
|
||||
vars.profileConf = node.NewNode("")
|
||||
|
||||
baseCmd := &cobra.Command{
|
||||
Use: "set [OPTIONS] [PROFILE ...]",
|
||||
@@ -44,28 +44,14 @@ func GetCommand() *cobra.Command {
|
||||
}
|
||||
|
||||
nodeDB, _ := node.New()
|
||||
profiles, _ := nodeDB.FindAllProfiles()
|
||||
var p_names []string
|
||||
for _, profile := range profiles {
|
||||
p_names = append(p_names, profile.Id.Get())
|
||||
}
|
||||
return p_names, cobra.ShellCompDirectiveNoFileComp
|
||||
profiles := nodeDB.ListAllProfiles()
|
||||
return profiles, cobra.ShellCompDirectiveNoFileComp
|
||||
},
|
||||
}
|
||||
vars.profileConf = node.NewConf()
|
||||
vars.converters = vars.profileConf.CreateFlags(baseCmd,
|
||||
[]string{"ipaddr", "ipaddr6", "ipmiaddr", "profile"})
|
||||
baseCmd.PersistentFlags().StringVar(&vars.netName, "netname", "default", "Set network name for network options")
|
||||
baseCmd.PersistentFlags().StringVarP(&vars.setNetDevDel, "netdel", "D", "", "Delete the node's network device")
|
||||
baseCmd.PersistentFlags().BoolVarP(&vars.setNodeAll, "all", "a", false, "Set all nodes")
|
||||
vars.profileConf.CreateFlags(baseCmd)
|
||||
vars.profileDel.CreateDelFlags(baseCmd)
|
||||
vars.profileAdd.CreateAddFlags(baseCmd)
|
||||
baseCmd.PersistentFlags().BoolVarP(&vars.setYes, "yes", "y", false, "Set 'yes' to all questions asked")
|
||||
baseCmd.PersistentFlags().BoolVarP(&vars.setForce, "force", "f", false, "Force configuration (even on error)")
|
||||
baseCmd.PersistentFlags().StringVar(&vars.fsName, "fsname", "", "set the file system name which must match a partition name")
|
||||
baseCmd.PersistentFlags().StringVar(&vars.partName, "partname", "", "set the partition name so it can be used by a file system")
|
||||
baseCmd.PersistentFlags().StringVar(&vars.diskName, "diskname", "", "set disk device name for the partition")
|
||||
baseCmd.PersistentFlags().StringVar(&vars.setDiskDel, "diskdel", "", "delete the disk from the configuration")
|
||||
baseCmd.PersistentFlags().StringVar(&vars.setPartDel, "partdel", "", "delete the partition from the configuration")
|
||||
baseCmd.PersistentFlags().StringVar(&vars.setFsDel, "fsdel", "", "delete the from the configuration")
|
||||
// register the command line completions
|
||||
if err := baseCmd.RegisterFlagCompletionFunc("container", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
list, _ := container.ListSources()
|
||||
|
||||
Reference in New Issue
Block a user