Skip to content

Commit 7e4b517

Browse files
authored
Merge pull request #25 from cisco-en-programmability/swim_bug_fixs
Swim Bug Fixes
2 parents 29cfee3 + 95f13ee commit 7e4b517

4 files changed

Lines changed: 48277 additions & 47555 deletions

File tree

plugins/module_utils/catalystcenter.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,44 @@ def get_site_id(self, site_name):
11921192

11931193
return (site_exists, site_id)
11941194

1195+
def get_global_site_id(self):
1196+
"""
1197+
Retrieve the Global site ID from Cisco Catalyst Center.
1198+
1199+
Args:
1200+
None
1201+
1202+
Returns:
1203+
str: The site ID (UUID) for the Global site.
1204+
1205+
Raises:
1206+
Calls fail_and_exit if the Global site cannot be resolved.
1207+
1208+
Description:
1209+
This helper function retrieves the Global site UUID from Cisco Catalyst Center.
1210+
Since the Global site always exists in Catalyst Center, this function either returns
1211+
the site_id or fails the module with a clear error message if resolution fails.
1212+
The function uses the site_exists() method to validate and retrieve the Global site ID.
1213+
"""
1214+
(site_exists, site_id) = self.site_exists("Global")
1215+
if site_exists:
1216+
self.log(
1217+
"Resolved Global site UUID for golden tagging workflow: {0}".format(
1218+
str(site_id)
1219+
),
1220+
"INFO",
1221+
)
1222+
return site_id
1223+
1224+
self.log(
1225+
"Global site lookup did not return a valid site ID for Catalyst Center version {0}."
1226+
.format(self.get_ccc_version()),
1227+
"ERROR",
1228+
)
1229+
self.msg = "Unable to resolve the Global site ID in Cisco Catalyst Center."
1230+
self.log(self.msg, "ERROR")
1231+
self.fail_and_exit(self.msg)
1232+
11951233
def assign_device_to_site(self, device_ids, site_name, site_id):
11961234
"""
11971235
Assign devices to the specified site.

0 commit comments

Comments
 (0)