Skip to content

Commit c6dab32

Browse files
author
Tom Warnock
committed
define dict once and modify
1 parent bd92eb4 commit c6dab32

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

cloudendure/cloudendure.py

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -460,30 +460,19 @@ def get_machine_sync_details(self) -> List[Any]:
460460
ce_project_inventory = json.loads(machines_response.text).get("items", [])
461461
for _query_value in ce_project_inventory:
462462
machine_name: str = _query_value["sourceProperties"]["name"]
463+
sync_details: Dict[str, Any] = {
464+
"machine_name": machine_name,
465+
"in_inventory": _query_value["isAgentInstalled"],
466+
"replication_status": _query_value["replicationStatus"],
467+
"last_seen_utc": _query_value["replicationInfo"]["lastSeenDateTime"],
468+
"total_storage_bytes": _query_value["replicationInfo"]["totalStorageBytes"],
469+
"replicated_storage_bytes": _query_value["replicationInfo"]["replicatedStorageBytes"],
470+
"rescanned_storage_bytes": 0,
471+
"backlogged_storage_bytes": _query_value["replicationInfo"]["backloggedStorageBytes"],
472+
}
463473
if "rescannedStorageBytes" in _query_value["replicationInfo"]:
464-
sync_details: Dict[str, Any] = {
465-
"machine_name": machine_name,
466-
"in_inventory": _query_value["isAgentInstalled"],
467-
"replication_status": _query_value["replicationStatus"],
468-
"last_seen_utc": _query_value["replicationInfo"]["lastSeenDateTime"],
469-
"total_storage_bytes": _query_value["replicationInfo"]["totalStorageBytes"],
470-
"replicated_storage_bytes": _query_value["replicationInfo"]["replicatedStorageBytes"],
471-
"rescanned_storage_bytes": _query_value["replicationInfo"]["rescannedStorageBytes"],
472-
"backlogged_storage_bytes": _query_value["replicationInfo"]["backloggedStorageBytes"],
473-
}
474-
response_list.append(sync_details)
475-
else:
476-
sync_details: Dict[str, Any] = {
477-
"machine_name": machine_name,
478-
"in_inventory": _query_value["isAgentInstalled"],
479-
"replication_status": _query_value["replicationStatus"],
480-
"last_seen_utc": _query_value["replicationInfo"]["lastSeenDateTime"],
481-
"total_storage_bytes": _query_value["replicationInfo"]["totalStorageBytes"],
482-
"replicated_storage_bytes": _query_value["replicationInfo"]["replicatedStorageBytes"],
483-
"rescanned_storage_bytes": 0,
484-
"backlogged_storage_bytes": _query_value["replicationInfo"]["backloggedStorageBytes"],
485-
}
486-
response_list.append(sync_details)
474+
sync_details["recanned_storage_bytes"] = _query_value["replicationInfo"]["rescannedStorageBytes"]
475+
response_list.append(sync_details)
487476
# Project is still printing to console as a convention; Emitting an
488477
# output to stdout for interactive usage
489478
return response_list

0 commit comments

Comments
 (0)