Skip to content

Commit

Permalink
[Network] az network dns export: export FQDN for MX, PTR, NS and SRV …
Browse files Browse the repository at this point in the history
…type instead of relative path (Azure#14734)

* finish code change

* code ready

* finish

* fix two tests
  • Loading branch information
mmyyrroonn authored Aug 12, 2020
1 parent 40f9c7d commit 50a63bf
Show file tree
Hide file tree
Showing 11 changed files with 2,137 additions and 2,137 deletions.
8 changes: 4 additions & 4 deletions src/azure-cli/azure/cli/command_modules/network/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1942,11 +1942,11 @@ def export_zone(cmd, resource_group_name, zone_name, file_name=None):
elif record_type == 'cname':
record_obj.update({'alias': record.cname.rstrip('.') + '.'})
elif record_type == 'mx':
record_obj.update({'preference': record.preference, 'host': record.exchange})
record_obj.update({'preference': record.preference, 'host': record.exchange.rstrip('.') + '.'})
elif record_type == 'ns':
record_obj.update({'host': record.nsdname})
record_obj.update({'host': record.nsdname.rstrip('.') + '.'})
elif record_type == 'ptr':
record_obj.update({'host': record.ptrdname})
record_obj.update({'host': record.ptrdname.rstrip('.') + '.'})
elif record_type == 'soa':
record_obj.update({
'mname': record.host.rstrip('.') + '.',
Expand All @@ -1958,7 +1958,7 @@ def export_zone(cmd, resource_group_name, zone_name, file_name=None):
zone_obj['$ttl'] = record.minimum_ttl
elif record_type == 'srv':
record_obj.update({'priority': record.priority, 'weight': record.weight,
'port': record.port, 'target': record.target})
'port': record.port, 'target': record.target.rstrip('.') + '.'})
elif record_type == 'txt':
record_obj.update({'txt': ''.join(record.value)})

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ def test_zone_file_1(self):
])
self._check_aaaa(zone, 'myaaaa.' + zn, [(3600, '2001:4898:e0:99:6dc4:6329:1c99:4e69')])
self._check_cname(zone, 'mycname.' + zn, 3600, 'contoso.com.')
self._check_ptr(zone, 'myname.' + zn, [(3600, 'myptrdname')])
self._check_ptr(zone, 'myptr.' + zn, [(3600, 'contoso.com')])
self._check_ptr(zone, 'myname.' + zn, [(3600, 'myptrdname.')])
self._check_ptr(zone, 'myptr.' + zn, [(3600, 'contoso.com.')])
self._check_txt(zone, 'myname2.' + zn, [(3600, 9, 'manualtxt')])
self._check_txt(zone, 'mytxt2.' + zn, [
(7200, 7, 'abc def'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ mya 0 A 10.0.1.0
mya 0 A 10.0.1.1
myaaaa 3600 AAAA 2001:4898:e0:99:6dc4:6329:1c99:4e69
mycname 3600 CNAME contoso.com.
myname 3600 PTR myptrdname
myptr 3600 PTR contoso.com
myname 3600 PTR myptrdname.
myptr 3600 PTR contoso.com.
myname2 3600 TXT "manualtxt"
mytxt2 7200 TXT "abc def"
mytxt2 7200 TXT "foo bar"
Expand Down

0 comments on commit 50a63bf

Please sign in to comment.