@@ -9,22 +9,150 @@ type MachineConfigNode struct {
99 Resource
1010}
1111
12+ // MachineConfigNodeList resource type declaration
13+ type MachineConfigNodeList struct {
14+ ResourceList
15+ }
16+
1217// NewMachineConfigNode constructor to get MCN resource
1318func NewMachineConfigNode (oc * exutil.CLI , node string ) * MachineConfigNode {
1419 return & MachineConfigNode {Resource : * NewResource (oc , "machineconfignode" , node )}
1520}
1621
17- // IsPinnedImageSetsDegraded returns true if the PinnedImageSetsDegraded condition is true
22+ // NewMachineConfigNodeList constructor to get MCN list
23+ func NewMachineConfigNodeList (oc * exutil.CLI ) * MachineConfigNodeList {
24+ return & MachineConfigNodeList {ResourceList : * NewResourceList (oc , "machineconfignodes" )}
25+ }
26+
27+ // GetAll get list of MachineConfigNode
28+ func (mcnl * MachineConfigNodeList ) GetAll () ([]* MachineConfigNode , error ) {
29+ resources , err := mcnl .ResourceList .GetAll ()
30+ if err != nil {
31+ return nil , err
32+ }
33+
34+ allMCNs := make ([]* MachineConfigNode , 0 , len (resources ))
35+ for _ , mcn := range resources {
36+ allMCNs = append (allMCNs , NewMachineConfigNode (mcnl .oc , mcn .GetName ()))
37+ }
38+
39+ return allMCNs , nil
40+ }
41+
42+ // GetDesiredMachineConfigOfSpec get value of `.spec.configVersion.desired`
43+ func (mcn * MachineConfigNode ) GetDesiredMachineConfigOfSpec () string {
44+ return mcn .GetOrFail (`{.spec.configVersion.desired}` )
45+ }
46+
47+ // GetDesiredMachineConfigOfStatus get value of `.status.configVersion.desired`
48+ func (mcn * MachineConfigNode ) GetDesiredMachineConfigOfStatus () string {
49+ return mcn .GetOrFail (`{.status.configVersion.desired}` )
50+ }
51+
52+ // GetCurrentMachineConfigOfStatus get value of `.status.configVersion.current`
53+ func (mcn * MachineConfigNode ) GetCurrentMachineConfigOfStatus () string {
54+ return mcn .GetOrFail (`{.status.configVersion.current}` )
55+ }
56+
57+ // GetPool get value of `.spec.pool.name`
58+ func (mcn * MachineConfigNode ) GetPoolName () (string , error ) {
59+ return mcn .Get (`{.spec.pool.name}` )
60+ }
61+
62+ // GetNode get value of `.spec.node.name`
63+ func (mcn * MachineConfigNode ) GetNode () string {
64+ return mcn .GetOrFail (`{.spec.node.name}` )
65+ }
66+
67+ // GetUpdated get condition status of `Updated`
68+ func (mcn * MachineConfigNode ) GetUpdated () string {
69+ return mcn .GetConditionStatusByType ("Updated" )
70+ }
71+
72+ // GetUpdatePrepared get condition status of `UpdatePrepared`
73+ func (mcn * MachineConfigNode ) GetUpdatePrepared () string {
74+ return mcn .GetConditionStatusByType ("UpdatePrepared" )
75+ }
76+
77+ // GetUpdateExecuted get condition status of `UpdateExecuted`
78+ func (mcn * MachineConfigNode ) GetUpdateExecuted () string {
79+ return mcn .GetConditionStatusByType ("UpdateExecuted" )
80+ }
81+
82+ // GetUpdatePostActionComplete get condition status of `UpdatePostActionComplete`
83+ func (mcn * MachineConfigNode ) GetUpdatePostActionComplete () string {
84+ return mcn .GetConditionStatusByType ("UpdatePostActionComplete" )
85+ }
86+
87+ // GetUpdateComplete get condition status of `UpdateComplete`
88+ func (mcn * MachineConfigNode ) GetUpdateComplete () string {
89+ return mcn .GetConditionStatusByType ("UpdateComplete" )
90+ }
91+
92+ // GetResumed get condition status of `Resumed`
93+ func (mcn * MachineConfigNode ) GetResumed () string {
94+ return mcn .GetConditionStatusByType ("Resumed" )
95+ }
96+
97+ // GetUpdateCompatible get condition status of `UpdateCompatible`
98+ func (mcn * MachineConfigNode ) GetUpdateCompatible () string {
99+ return mcn .GetConditionStatusByType ("UpdateCompatible" )
100+ }
101+
102+ // GetAppliedFilesAndOS get condition status of `AppliedFilesAndOS`
103+ func (mcn * MachineConfigNode ) GetAppliedFilesAndOS () string {
104+ return mcn .GetConditionStatusByType ("AppliedFilesAndOS" )
105+ }
106+
107+ // GetCordoned get condition status of `Cordoned`
108+ func (mcn * MachineConfigNode ) GetCordoned () string {
109+ return mcn .GetConditionStatusByType ("Cordoned" )
110+ }
111+
112+ // GetUncordoned get condition status of `Uncordoned`
113+ func (mcn * MachineConfigNode ) GetUncordoned () string {
114+ return mcn .GetConditionStatusByType ("Uncordoned" )
115+ }
116+
117+ // GetDrained get condition status of `Drained`
118+ func (mcn * MachineConfigNode ) GetDrained () string {
119+ return mcn .GetConditionStatusByType ("Drained" )
120+ }
121+
122+ // GetRebootedNode get condition status of `RebootedNode`
123+ func (mcn * MachineConfigNode ) GetRebootedNode () string {
124+ return mcn .GetConditionStatusByType ("RebootedNode" )
125+ }
126+
127+ // GetReloadedCRIO get condition status of `ReloadedCRIO`
128+ func (mcn * MachineConfigNode ) GetReloadedCRIO () string {
129+ return mcn .GetConditionStatusByType ("ReloadedCRIO" )
130+ }
131+
18132func (mcn * MachineConfigNode ) IsPinnedImageSetsDegraded () bool {
19133 return mcn .IsConditionStatusTrue ("PinnedImageSetsDegraded" )
20134}
21135
22- // IsPinnedImageSetsProgressing returns true if the PinnedImageSetsProgressing condition is true
23136func (mcn * MachineConfigNode ) IsPinnedImageSetsProgressing () bool {
24137 return mcn .IsConditionStatusTrue ("PinnedImageSetsProgressing" )
25138}
26139
27- // GetPinnedImageSetLastFailedError returns the last failed generation error for pinned image sets
140+ // GetDesiredMachineConfigOfSpec get value of `.spec.configVersion.desired`
28141func (mcn * MachineConfigNode ) GetPinnedImageSetLastFailedError () string {
29142 return mcn .GetOrFail (`{.status.pinnedImageSets[*].lastFailedGenerationError}` )
30143}
144+
145+ // GetDesiredImage get value of `.spec.configImage.desiredImage`
146+ func (mcn * MachineConfigNode ) GetSpecDesiredImage () (string , error ) {
147+ return mcn .Get (`{.spec.configImage.desiredImage}` )
148+ }
149+
150+ // GetStatusDesiredImage get value of `.status.configImage.desiredImage`
151+ func (mcn * MachineConfigNode ) GetStatusDesiredImage () (string , error ) {
152+ return mcn .Get (`{.status.configImage.desiredImage}` )
153+ }
154+
155+ // GetStatusCurrentImage get value of `.status.configImage.currentImage`
156+ func (mcn * MachineConfigNode ) GetStatusCurrentImage () (string , error ) {
157+ return mcn .Get (`{.status.configImage.currentImage}` )
158+ }
0 commit comments