Skip to content

Commit

Permalink
[Network] az network dns zone import: Fix alias records cannot be i…
Browse files Browse the repository at this point in the history
…mported (Azure#26507)
  • Loading branch information
nis-spiir authored and vidit-msft committed Jun 27, 2023
1 parent bbb146e commit 072398b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/azure-cli/azure/cli/command_modules/network/custom.py
Expand Up @@ -2710,7 +2710,10 @@ def import_zone(cmd, resource_group_name, zone_name, file_name):
rs_name = rs_name[:-(len(origin) + 1)] if rs_name != origin else '@'
try:
record_count = len(rs[_type_to_property_name(rs_type)[0]])
except TypeError:
except (TypeError, KeyError):
# There is some bug with `alias records` being mapped from `AZURE ALIAS A` to `ARecords`,
# but `rs` does not contain `a_records`. We could fix it, but this is just logging, so
# lets not fail the whole import and hope someone refactors this method
record_count = 1
total_records += record_count
cum_records = 0
Expand All @@ -2729,7 +2732,7 @@ def import_zone(cmd, resource_group_name, zone_name, file_name):

try:
record_count = len(rs[_type_to_property_name(rs_type)[0]])
except TypeError:
except (TypeError, KeyError):
record_count = 1
if rs_name == '@' and rs_type == 'soa':
root_soa = client.record_sets.get(resource_group_name, zone_name, '@', 'SOA')
Expand Down

0 comments on commit 072398b

Please sign in to comment.