diff --git a/backend/api/appd/AppDService.py b/backend/api/appd/AppDService.py index 53ecdc5..54efb85 100644 --- a/backend/api/appd/AppDService.py +++ b/backend/api/appd/AppDService.py @@ -752,7 +752,24 @@ async def getServers(self) -> Result: response = await self.controller.getServersKeys(json.dumps(body)) serverKeys = await self.getResultFromResponse(response, debugString) - machineIds = [serverKey["machineId"] for serverKey in serverKeys.data["machineKeys"]] + machineIds = [] + if not isinstance(serverKeys.data["machineKeys"], list): + logging.warning("Expected 'serverKeys.data[\"machineKeys\"]' to be a " + "list, but got {}".format(type(serverKeys.data["machineKeys"]))) + else: + for serverKey in serverKeys.data["machineKeys"]: + if isinstance(serverKey, dict) and "machineId" in serverKey: + try: + machineIds.append(serverKey["machineId"]) + except TypeError: + logging.warning("TypeError encountered with " + "machineId: {}".format(serverKey["machineId"])) + else: + if isinstance(serverKey, dict): + logging.warning("Dictionary lacks 'machineId' key: {}".format(serverKey)) + else: + logging.warning("Expected a dictionary, but found type: {}".format(type(serverKey))) + serverFutures = [self.controller.getServer(serverId) for serverId in machineIds] serversResponses = await AsyncioUtils.gatherWithConcurrency(*serverFutures) diff --git a/backend/output/presentations/cxPptFsoUseCases.py b/backend/output/presentations/cxPptFsoUseCases.py index 33d174d..fee8165 100644 --- a/backend/output/presentations/cxPptFsoUseCases.py +++ b/backend/output/presentations/cxPptFsoUseCases.py @@ -663,7 +663,9 @@ def cleanup_slides(root: Presentation, uc: UseCase): def calculate_kpis(apm_wb, agent_wb, uc: UseCase): # currently only supports one controller report out of the workbook controller = getValuesInColumn(apm_wb["Analysis"], "controller")[0] - logging.info(f"processing report for 1st controller only as multiple controllers are not supported yet: {controller}") + logging.info(f"processing CX HAM Use Case report for 1st controller only " + f"as multiple " + f"controllers are not supported yet: {controller}") totalApplications = getRowCountForController(apm_wb["Analysis"], controller) percentAgentsReportingData = getValuesInColumnForController(apm_wb["AppAgentsAPM"], "percentAgentsReportingData", controller)