Skip to content

Commit 2c9d337

Browse files
authored
Merge pull request #18 from cisco-en-programmability/swim_bug_fix
Fix SWIM golden-tag flow when device_tags is omitted in tagging_details
2 parents 0d33dc2 + c9114fb commit 2c9d337

3 files changed

Lines changed: 47556 additions & 15187 deletions

File tree

plugins/modules/swim_workflow_manager.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3375,12 +3375,40 @@ def get_diff_tagging(self):
33753375
)
33763376
self.log("Product name ordinal: {0}".format(product_name_ordinal), "DEBUG")
33773377

3378-
device_tags = tagging_details.get("device_tags")
3378+
device_tags = tagging_details.get("device_tags", [])
3379+
if not device_tags:
3380+
self.log(
3381+
"No 'device_tags' provided in tagging_details. "
3382+
"Proceeding with golden tagging without device-tag filtering.",
3383+
"DEBUG",
3384+
)
3385+
else:
3386+
self.log(
3387+
"Resolving {0} device tag(s) from tagging_details: {1}".format(
3388+
len(device_tags), device_tags
3389+
),
3390+
"DEBUG",
3391+
)
3392+
33793393
device_tags_ids = []
33803394
for device_tag in device_tags:
33813395
self.log("Device tag to be applied: {0}".format(device_tag), "DEBUG")
33823396
device_tags_id = self.get_network_device_tag_id(device_tag)
3397+
if not device_tags_id:
3398+
self.log(
3399+
"Device tag '{0}' could not be resolved to an ID in Cisco Catalyst Center "
3400+
"and will be skipped.".format(device_tag),
3401+
"WARNING",
3402+
)
3403+
continue
3404+
33833405
device_tags_ids.append(device_tags_id)
3406+
3407+
self.log(
3408+
"Resolved device tag IDs for payload: {0}".format(device_tags_ids),
3409+
"DEBUG",
3410+
)
3411+
33843412
# -----------------------------------------------------
33853413
# STEP 4: Build payload
33863414
# -----------------------------------------------------

0 commit comments

Comments
 (0)