Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Network] az network dns zone import: Fix alias records cannot be imported #26507

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/azure-cli/azure/cli/command_modules/network/custom.py
Original file line number Diff line number Diff line change
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