Skip to content

Commit 7430cd5

Browse files
authored
Merge pull request #362 from myakove/nncp-check-unknown-status
nncp: check status unknown before validate
2 parents 4460649 + 8c14eef commit 7430cd5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

ocp_resources/node_network_configuration_policy.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,20 @@ def status(self):
341341
if condition["type"] == self.Conditions.Type.AVAILABLE:
342342
return condition["reason"]
343343

344-
def _wait_for_configuration_progressing(self):
345-
samples = TimeoutSampler(wait_timeout=30, sleep=1, func=self.status)
344+
def _wait_for_configuration_conditions_unknown_or_progressing(self):
345+
samples = TimeoutSampler(
346+
wait_timeout=30, sleep=1, func=lambda: self.instance.status.conditions
347+
)
346348
for sample in samples:
347-
if sample and sample == self.Conditions.Reason.CONFIGURATION_PROGRESSING:
349+
if (
350+
sample
351+
and sample[0]["type"] == self.Conditions.Type.AVAILABLE
352+
and (
353+
sample[0]["status"] == self.Condition.Status.UNKNOWN
354+
or sample[0]["reason"]
355+
== self.Conditions.Reason.CONFIGURATION_PROGRESSING
356+
)
357+
):
348358
return
349359

350360
def wait_for_status_success(self):
@@ -368,7 +378,7 @@ def _process_failed_status():
368378
)
369379

370380
# if we get here too fast there are no conditions, we need to wait.
371-
self._wait_for_configuration_progressing()
381+
self._wait_for_configuration_conditions_unknown_or_progressing()
372382

373383
samples = TimeoutSampler(wait_timeout=480, sleep=1, func=self.status)
374384
try:

0 commit comments

Comments
 (0)