Skip to content

Commit 62000b2

Browse files
authored
Fix poap workflows (#533)
1 parent b0dd4d6 commit 62000b2

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

plugins/action/dtc/get_poap_data.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def __init__(self, params):
6969
self.fabric_name = self.model_data['vxlan']['fabric']['name']
7070
self.switches = self.model_data['vxlan']['topology']['switches']
7171
self.poap_supported_switches = False
72+
self.poap_switches = []
7273
self.preprovision_supported_switches = False
7374
self.poap_data = []
7475
self.poap_get_method = "GET"
@@ -90,6 +91,8 @@ def check_poap_supported_switches(self) -> None:
9091
if self._get_discovered(ip, role, hostname):
9192
# This switch is already discovered by the fabric so does not need to be POAP'd
9293
continue
94+
# Append switch to self.poap_switches list
95+
self.poap_switches.append(switch)
9396
self.poap_supported_switches = True
9497

9598
def check_preprovision_supported_switches(self) -> None:
@@ -241,14 +244,19 @@ def run(self, tmp=None, task_vars=None):
241244
# fabric setting for this might be modified if/when the create
242245
# role is executed later in this run.
243246
fail_msg = workflow.refresh_message
244-
match_text = r"Please\s+enable\s+the\s+DHCP\s+in\s+Fabric\s+Settings\s+to\s+start\s+the\s+bootstrap"
245-
if re.search(match_text, fail_msg, re.IGNORECASE):
246-
pass
247-
match_text = r"Invalid\s+Fabric"
248-
if re.search(match_text, fail_msg, re.IGNORECASE):
249-
pass
247+
match_cases = [
248+
r"Please\s+enable\s+the\s+DHCP\s+in\s+Fabric\s+Settings\s+to\s+start\s+the\s+bootstrap",
249+
r"Invalid\s+Fabric",
250+
]
251+
for match_text in match_cases:
252+
if re.search(match_text, fail_msg, re.IGNORECASE):
253+
# If we match one of the expected messages then we
254+
# just ignore it and continue.
255+
results['poap_data'] = {}
256+
break
250257
else:
251-
# Return any messages we don't recognize and fail
258+
# If we did not match any of the expected messages then
259+
# we return a failure message.
252260
results['failed'] = True
253261
results['message'] = "Unrecognized Failure Attempting To Get POAP Data: {0}".format(fail_msg)
254262
return results
@@ -258,10 +266,12 @@ def run(self, tmp=None, task_vars=None):
258266
# model then we should not continue until we have POAP data
259267
# from NDFC
260268
results['failed'] = True
261-
msg = "POAP is enabled on at least one switch in the service model but "
269+
msg = "POAP is enabled on at least one switch in the service model that is NOT currently discovered but "
262270
msg += "POAP bootstrap data is not yet available from NDFC. "
263271
msg += "To disable poap on a device set (poap.boostrap) to (False) under (vxlan.topology.switches)"
264272
results['message'] = msg
273+
results['poap_switches'] = workflow.poap_switches
274+
results['hints'] = "Double check that the role in the data model matches if a device with this same IP has been discovered"
265275
return results
266276

267277
return results

0 commit comments

Comments
 (0)