Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/command_modules/azure-cli-network/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ unreleased
* Remove nulls values from output of `network vpn-connection list/show` commands.
* BC: Fix bug in the output of `vpn-connection create`
* Fix bug where '--key-length' argument of 'vpn-connection create' was not parsed correctly.
* Fix bug in `dns zone import` where records were not imported correctly.

2.0.2 (2017-04-03)
++++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1884,8 +1884,20 @@ def import_zone(resource_group_name, zone_name, file_name):
record = _build_record(entry)
record_set = record_sets.get(record_set_key, None)
if not record_set:

# Workaround for issue #2824
relative_record_set_name = record_set_name.rstrip('.')
if not relative_record_set_name.endswith(origin):
logger.warning(
'Cannot import %s. Only records relative to origin may be '
'imported at this time. Skipping...', relative_record_set_name)
continue

if record_set_type != 'soa' and relative_record_set_name != origin:
relative_record_set_name = record_set_name[:-(len(origin) + 2)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's -(len(origin) + 2) for?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of the workaround to strip the origin back off of the name. The old implementation was to use absolute names. If/when the service fixes itself to allow this, I will just remove this workaround and import all records as absolute references (which the DNS import spec says it should support).


record_set = RecordSet(
name=record_set_name.rstrip('.'), type=record_set_type, ttl=record_set_ttl)
name=relative_record_set_name, type=record_set_type, ttl=record_set_ttl)
record_sets[record_set_key] = record_set
_add_record(record_set, record, record_set_type,
is_list=record_set_type.lower() not in ['soa', 'cname'])
Expand Down
Loading