@@ -212,7 +212,10 @@ func (n *Node) GetCurrentBootOSImage() (string, error) {
212212
213213// RestoreDesiredConfig changes the value of the desiredConfig annotation to equal the value of currentConfig. desiredConfig=currentConfig.
214214func (n * Node ) RestoreDesiredConfig () error {
215- currentConfig := n .GetCurrentMachineConfig ()
215+ currentConfig , err := n .GetCurrentMachineConfig ()
216+ if err != nil {
217+ return err
218+ }
216219 if currentConfig == "" {
217220 return fmt .Errorf ("currentConfig annotation has an empty value in node %s" , n .GetName ())
218221 }
@@ -227,8 +230,8 @@ func (n *Node) RestoreDesiredConfig() error {
227230}
228231
229232// GetCurrentMachineConfig returns the ID of the current machine config used in the node
230- func (n * Node ) GetCurrentMachineConfig () string {
231- return n .GetOrFail (`{.metadata.annotations.machineconfiguration\.openshift\.io/currentConfig}` )
233+ func (n * Node ) GetCurrentMachineConfig () ( string , error ) {
234+ return n .Get (`{.metadata.annotations.machineconfiguration\.openshift\.io/currentConfig}` )
232235}
233236
234237// GetCurrentImage returns the current image used in this node
@@ -237,13 +240,13 @@ func (n *Node) GetCurrentImage() string {
237240}
238241
239242// GetDesiredMachineConfig returns the ID of the machine config that we want the node to use
240- func (n * Node ) GetDesiredMachineConfig () string {
241- return n .GetOrFail (`{.metadata.annotations.machineconfiguration\.openshift\.io/desiredConfig}` )
243+ func (n * Node ) GetDesiredMachineConfig () ( string , error ) {
244+ return n .Get (`{.metadata.annotations.machineconfiguration\.openshift\.io/desiredConfig}` )
242245}
243246
244247// GetMachineConfigState returns the State of machineconfiguration process
245- func (n * Node ) GetMachineConfigState () string {
246- return n .GetOrFail (`{.metadata.annotations.machineconfiguration\.openshift\.io/state}` )
248+ func (n * Node ) GetMachineConfigState () ( string , error ) {
249+ return n .Get (`{.metadata.annotations.machineconfiguration\.openshift\.io/state}` )
247250}
248251
249252// PatchDesiredConfig patches the desiredConfig annotation with the provided value
@@ -272,8 +275,23 @@ func (n *Node) HasBeenDrained() bool {
272275}
273276
274277// IsUpdated returns if the node is pending for machineconfig configuration or it is up to date
275- func (n * Node ) IsUpdated () bool {
276- return (n .GetCurrentMachineConfig () == n .GetDesiredMachineConfig ()) && (n .GetMachineConfigState () == "Done" )
278+ func (n * Node ) IsUpdated () (bool , error ) {
279+ currentConfig , err := n .GetCurrentMachineConfig ()
280+ if err != nil {
281+ return false , err
282+ }
283+
284+ desiredConfig , err := n .GetDesiredMachineConfig ()
285+ if err != nil {
286+ return false , err
287+ }
288+
289+ state , err := n .GetMachineConfigState ()
290+ if err != nil {
291+ return false , err
292+ }
293+
294+ return (currentConfig == desiredConfig ) && (state == "Done" ), nil
277295}
278296
279297// IsTainted returns if the node hast taints or not
0 commit comments