@@ -32,6 +32,7 @@ class Reason:
3232 CONFIGURING = "ConfigurationProgressing"
3333 SUCCESS = "SuccessfullyConfigured"
3434 FAILED = "FailedToConfigure"
35+ NO_MATCHING_NODE = "NoMatchingNode"
3536
3637 def __init__ (
3738 self ,
@@ -301,6 +302,8 @@ def status(self):
301302 return condition ["reason" ]
302303
303304 def wait_for_status_success (self ):
305+ failed_condition_reason = self .Conditions .Reason .FAILED
306+ no_match_node_condition_reason = self .Conditions .Reason .NO_MATCHING_NODE
304307 # if we get here too fast there are no conditions, we need to wait.
305308 self .wait_for_conditions ()
306309
@@ -311,7 +314,12 @@ def wait_for_status_success(self):
311314 LOGGER .info ("NNCP configured Successfully" )
312315 return sample
313316
314- if sample == self .Conditions .Reason .FAILED :
317+ if sample == no_match_node_condition_reason :
318+ raise NNCPConfigurationFailed (
319+ f"Reason: { no_match_node_condition_reason } "
320+ )
321+
322+ if sample == failed_condition_reason :
315323 for failed_nnce in self ._get_failed_nnce ():
316324 nnce_dict = failed_nnce .instance .to_dict ()
317325 for cond in nnce_dict ["status" ]["conditions" ]:
@@ -323,9 +331,7 @@ def wait_for_status_success(self):
323331 f"NNCE { nnce_dict ['metadata' ]['name' ]} : { error [0 ]} "
324332 )
325333
326- raise NNCPConfigurationFailed (
327- f"Reason: { self .Conditions .Reason .FAILED } "
328- )
334+ raise NNCPConfigurationFailed (f"Reason: { failed_condition_reason } " )
329335
330336 except (TimeoutExpiredError , NNCPConfigurationFailed ):
331337 LOGGER .error ("Unable to configure NNCP for node" )
0 commit comments