Skip to content

Commit 0e5bef9

Browse files
author
ianna1-admin
committed
fix afs tier filtering for list rps
1 parent d7e8a34 commit 0e5bef9

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/azure-cli/azure/cli/command_modules/backup/custom_afs.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,24 @@ def list_recovery_points(cmd, client, resource_group_name, vault_name, item, sta
280280
# Prepare to collect tier types
281281
rp_tier_types = []
282282

283-
# Safely grab additional_properties
284-
additional_props = getattr(rp.properties, 'additional_properties', {})
285-
if not isinstance(additional_props, dict):
286-
continue
287-
288-
# Get details list
289-
tier_details_list = additional_props.get("recoveryPointTierDetails", [])
283+
# Get recovery point tier details directly from properties
284+
tier_details_list = getattr(rp.properties, 'recovery_point_tier_details', None)
285+
286+
# If not found, check for the alternate property name
287+
if tier_details_list is None:
288+
tier_details_list = getattr(rp.properties, 'recoveryPointTierDetails', [])
289+
290290
if not isinstance(tier_details_list, list):
291291
continue
292292

293293
for detail in tier_details_list:
294-
if not isinstance(detail, dict):
294+
if hasattr(detail, 'type'):
295+
rp_type = detail.type
296+
elif isinstance(detail, dict):
297+
rp_type = detail.get("type")
298+
else:
295299
continue
296-
rp_type = detail.get("type")
300+
297301
if rp_type:
298302
rp_tier_types.append(rp_type)
299303

@@ -321,7 +325,6 @@ def list_recovery_points(cmd, client, resource_group_name, vault_name, item, sta
321325

322326
return paged_recovery_points
323327

324-
325328
def update_policy_for_item(cmd, client, resource_group_name, vault_name, item, policy, tenant_id=None,
326329
is_critical_operation=False, yes=False):
327330
if item.properties.backup_management_type != policy.properties.backup_management_type:

0 commit comments

Comments
 (0)