simplified node list command

This commit is contained in:
Christian Goll
2022-07-18 19:27:57 +02:00
parent 1dd519a7e6
commit e23f794166
8 changed files with 442 additions and 866 deletions

View File

@@ -108,7 +108,6 @@ node itself, for all values of type Entry.
*/
type NodeInfo struct {
Id Entry
Cid Entry
Comment Entry
ClusterName Entry
ContainerName Entry
@@ -122,7 +121,6 @@ type NodeInfo struct {
Kernel *KernelEntry
Ipmi *IpmiEntry
Profiles []string
GroupProfiles []string
NetDevs map[string]*NetDevEntry
Tags map[string]*Entry
}
@@ -140,7 +138,6 @@ type IpmiEntry struct {
}
type KernelEntry struct {
Version Entry
Override Entry
Args Entry
}
@@ -160,6 +157,9 @@ type NetDevEntry struct {
Tags map[string]*Entry
}
// string which is printed if no value is set
const NoValue = "--"
func init() {
// Check that nodes.conf is found
if !util.IsFile(ConfigFile) {

View File

@@ -580,3 +580,20 @@ func (baseCmd *CobraCommand) CreateFlags(theStruct interface{}, excludeList []st
}
return optionsMap
}
/*
Helper function which gets the lopt of a given interface
*/
func GetLoptOf(myStruct interface{}, name string) string {
retStr := ""
if reflect.TypeOf(myStruct).Kind() != reflect.Struct {
return retStr
}
myType := reflect.TypeOf(myStruct)
field, ok := myType.FieldByName(name)
if ok {
retStr = field.Tag.Get("lopt")
}
return retStr
}