@@ -447,34 +447,35 @@ def check_licenses(self) -> Dict[str, Any]:
447447
448448 return response_dict
449449
450- def get_machine_sync_details (self ) -> List [Any ]:
450+ def get_machine_sync_details (self ) -> Dict [Any ]:
451451 """Checks CloudEndure Project inventory and returns register machine replication state.
452452 """
453- response_list : List [Any ] = []
454453 print (f"INFO: Retreiving sync status for all machines in Project: ({ self .project_name } )" )
455454 machines_response : Response = self .api .api_call (f"projects/{ self .project_id } /machines" )
456455 if not machines_response .ok :
457456 print (f"ERROR: API response did not return a 2XX status; Returned { machines_response .status_code } ..." )
458457 return {}
458+ response_dict : Dict [str , Any ] = {}
459459 ce_project_inventory = json .loads (machines_response .text ).get ("items" , [])
460460 for _query_value in ce_project_inventory :
461- machine_name : str = _query_value ["sourceProperties" ][ "name " ]
462- sync_details : Dict [ str , Any ] = {
463- "machine_name" : machine_name ,
461+ machine_id : str = _query_value ["id " ]
462+ response_dict [ machine_id ] = {
463+ "machine_name" : _query_value [ "sourceProperties" ][ "name" ] ,
464464 "in_inventory" : _query_value ["isAgentInstalled" ],
465465 "replication_status" : _query_value ["replicationStatus" ],
466- "last_seen_utc" : _query_value [ "replicationInfo" ][ "lastSeenDateTime" ] ,
466+ "last_seen_utc" : "N/A" ,
467467 "total_storage_bytes" : _query_value ["replicationInfo" ]["totalStorageBytes" ],
468468 "replicated_storage_bytes" : _query_value ["replicationInfo" ]["replicatedStorageBytes" ],
469469 "rescanned_storage_bytes" : 0 ,
470470 "backlogged_storage_bytes" : _query_value ["replicationInfo" ]["backloggedStorageBytes" ],
471471 }
472- if "rescannedStorageBytes" in _query_value ["replicationInfo" ]:
473- sync_details ["recanned_storage_bytes" ] = _query_value ["replicationInfo" ]["rescannedStorageBytes" ]
474- response_list .append (sync_details )
472+ if "lastSeenDateTime" in _query_value ["replicationInfo" ].keys ():
473+ response_dict [machine_id ]["last_seen_utc" ] = _query_value ["replicationInfo" ]["lastSeenDateTime" ]
474+ if "rescannedStorageBytes" in _query_value ["replicationInfo" ].keys ():
475+ response_dict [machine_id ]["rescanned_storage_bytes" ] = _query_value ["replicationInfo" ]["rescannedStorageBytes" ]
475476 # Project is still printing to console as a convention; Emitting an
476477 # output to stdout for interactive usage
477- return response_list
478+ return response_dict
478479
479480 def inspect_ce_project (self , check_type : str ) -> List [Any ]:
480481 if not check_type :
0 commit comments