Skip to content

Commit bf734ff

Browse files
WhiteHorseVSandeep Kadagathur Vadiraj
andauthored
{Network} az network dns zone: Fix for the zone import logic (#30383)
Co-authored-by: Sandeep Kadagathur Vadiraj <[email protected]>
1 parent 6073be7 commit bf734ff

15 files changed

+3663
-3343
lines changed

src/azure-cli/azure/cli/command_modules/network/custom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2811,8 +2811,9 @@ def import_zone(cmd, resource_group_name, zone_name, file_name):
28112811
rs = _convert_to_snake_case(root_ns)
28122812
try:
28132813
rs["target_resource"] = rs.get("target_resource").get("id") if rs.get("target_resource") else None
2814-
28152814
_record_create = _record_create_func(rs_type)
2815+
if 'traffic_management_profile' in rs:
2816+
del rs['traffic_management_profile']
28162817
_record_create(cli_ctx=cmd.cli_ctx)(command_args={
28172818
'resource_group': resource_group_name,
28182819
'zone_name': zone_name,

src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_dns.yaml

Lines changed: 1002 additions & 828 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_dns_delegation.yaml

Lines changed: 124 additions & 124 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_dns_dnssec.yaml

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_dns_if_none_match.yaml

Lines changed: 596 additions & 420 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_dns_tmlink.yaml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"location": "global", "properties": {"zoneType": "Public"}}'
3+
body: '{"location": "global"}'
44
headers:
55
Accept:
66
- application/json
@@ -11,18 +11,18 @@ interactions:
1111
Connection:
1212
- keep-alive
1313
Content-Length:
14-
- '60'
14+
- '22'
1515
Content-Type:
1616
- application/json
1717
ParameterSetName:
1818
- -g -n
1919
User-Agent:
20-
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.26058-SP0)
20+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.8.10 (Windows-10-10.0.26100-SP0)
2121
method: PUT
2222
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns_tmlink000001/providers/Microsoft.Network/dnsZones/mytestzone2.com?api-version=2023-07-01-preview
2323
response:
2424
body:
25-
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com","name":"mytestzone2.com","type":"Microsoft.Network\/dnszones","etag":"133357de-50ec-4d58-ba3e-c96cf2eeb6ea","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":10000,"maxNumberOfRecordsPerRecordSet":null,"nameServers":["ns1-34.ppe.azure-dns.com.","ns2-34.ppe.azure-dns.net.","ns3-34.ppe.azure-dns.org.","ns4-34.ppe.azure-dns.info."],"numberOfRecordSets":2,"zoneType":"Public"}}'
25+
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com","name":"mytestzone2.com","type":"Microsoft.Network\/dnszones","etag":"4dc65717-9cac-4bb8-b632-b1950f40bca9","location":"global","tags":{},"properties":{"maxNumberOfRecordSets":10000,"maxNumberOfRecordsPerRecordSet":null,"nameServers":["ns1-35.ppe.azure-dns.com.","ns2-35.ppe.azure-dns.net.","ns3-35.ppe.azure-dns.org.","ns4-35.ppe.azure-dns.info."],"numberOfRecordSets":2,"zoneType":"Public"}}'
2626
headers:
2727
cache-control:
2828
- private
@@ -31,9 +31,9 @@ interactions:
3131
content-type:
3232
- application/json; charset=utf-8
3333
date:
34-
- Wed, 06 Mar 2024 23:20:57 GMT
34+
- Tue, 19 Nov 2024 21:56:21 GMT
3535
etag:
36-
- 133357de-50ec-4d58-ba3e-c96cf2eeb6ea
36+
- 4dc65717-9cac-4bb8-b632-b1950f40bca9
3737
strict-transport-security:
3838
- max-age=31536000; includeSubDomains
3939
x-cache:
@@ -43,7 +43,7 @@ interactions:
4343
x-ms-ratelimit-remaining-subscription-resource-requests:
4444
- '11999'
4545
x-msedge-ref:
46-
- 'Ref A: 97026DB680074FEAB2354B49EA9C2C9D Ref B: CO6AA3150217027 Ref C: 2024-03-06T23:20:53Z'
46+
- 'Ref A: 328C09CB1EE540F2B35DCF6338CA6801 Ref B: CO6AA3150220027 Ref C: 2024-11-19T21:56:18Z'
4747
x-powered-by:
4848
- ASP.NET
4949
status:
@@ -70,21 +70,21 @@ interactions:
7070
ParameterSetName:
7171
- -g -n --unique-dns-name --routing-method
7272
User-Agent:
73-
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.26058-SP0)
73+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.8.10 (Windows-10-10.0.26100-SP0)
7474
method: PUT
7575
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns_tmlink000001/providers/Microsoft.Network/trafficmanagerprofiles/tm2?api-version=2022-04-01
7676
response:
7777
body:
78-
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/trafficManagerProfiles\/tm2","name":"tm2","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Performance","dnsConfig":{"relativeName":"mytesttrafficmanager2","fqdn":"mytesttrafficmanager2.preprodtrafficmanager.azure","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/","intervalInSeconds":30,"toleratedNumberOfFailures":3,"timeoutInSeconds":10},"endpoints":[],"trafficViewEnrollmentStatus":"Disabled","maxReturn":null}}'
78+
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/trafficManagerProfiles\/tm2","name":"tm2","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Performance","dnsConfig":{"relativeName":"mytesttrafficmanager2","fqdn":"mytesttrafficmanager2.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/","intervalInSeconds":30,"toleratedNumberOfFailures":3,"timeoutInSeconds":10},"endpoints":[],"trafficViewEnrollmentStatus":"Disabled","maxReturn":null,"recordType":null}}'
7979
headers:
8080
cache-control:
8181
- private
8282
content-length:
83-
- '687'
83+
- '696'
8484
content-type:
8585
- application/json; charset=utf-8
8686
date:
87-
- Wed, 06 Mar 2024 23:21:01 GMT
87+
- Tue, 19 Nov 2024 21:56:25 GMT
8888
strict-transport-security:
8989
- max-age=31536000; includeSubDomains
9090
x-aspnet-version:
@@ -96,7 +96,7 @@ interactions:
9696
x-ms-ratelimit-remaining-subscription-resource-requests:
9797
- '4499'
9898
x-msedge-ref:
99-
- 'Ref A: D9F124F61BB84CA19EEE855E5C282F03 Ref B: CO6AA3150218017 Ref C: 2024-03-06T23:20:58Z'
99+
- 'Ref A: 26A60A2426864C49B64DBBB0FEC884FD Ref B: CO6AA3150217025 Ref C: 2024-11-19T21:56:22Z'
100100
x-powered-by:
101101
- ASP.NET
102102
status:
@@ -120,12 +120,12 @@ interactions:
120120
ParameterSetName:
121121
- -g -z -n --traffic-management-profile
122122
User-Agent:
123-
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.26058-SP0)
123+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.8.10 (Windows-10-10.0.26100-SP0)
124124
method: PUT
125125
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns_tmlink000001/providers/Microsoft.Network/dnsZones/mytestzone2.com/A/tmlink?api-version=2023-07-01-preview
126126
response:
127127
body:
128-
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com\/A\/tmlink","name":"tmlink","type":"Microsoft.Network\/dnszones\/A","etag":"b5691ecd-07d9-44d3-892a-6074efef6eff","properties":{"fqdn":"tmlink.mytestzone2.com.","TTL":30,"targetResource":{},"trafficManagementProfile":{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/trafficManagerProfiles\/tm2"},"provisioningState":"Succeeded"}}'
128+
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com\/A\/tmlink","name":"tmlink","type":"Microsoft.Network\/dnszones\/A","etag":"f0132a2a-8875-457f-bb4b-f240bf0db66d","properties":{"fqdn":"tmlink.mytestzone2.com.","TTL":30,"targetResource":{},"trafficManagementProfile":{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/trafficManagerProfiles\/tm2"},"provisioningState":"Succeeded"}}'
129129
headers:
130130
cache-control:
131131
- private
@@ -134,9 +134,9 @@ interactions:
134134
content-type:
135135
- application/json; charset=utf-8
136136
date:
137-
- Wed, 06 Mar 2024 23:21:17 GMT
137+
- Tue, 19 Nov 2024 21:56:40 GMT
138138
etag:
139-
- b5691ecd-07d9-44d3-892a-6074efef6eff
139+
- f0132a2a-8875-457f-bb4b-f240bf0db66d
140140
strict-transport-security:
141141
- max-age=31536000; includeSubDomains
142142
x-cache:
@@ -146,7 +146,7 @@ interactions:
146146
x-ms-ratelimit-remaining-subscription-resource-requests:
147147
- '11999'
148148
x-msedge-ref:
149-
- 'Ref A: 2DBF10F499744FF4888B5587E30700CF Ref B: CO6AA3150219033 Ref C: 2024-03-06T23:21:05Z'
149+
- 'Ref A: 5952406B87AC4E5DB3DC5AF328013A44 Ref B: CO6AA3150220031 Ref C: 2024-11-19T21:56:26Z'
150150
x-powered-by:
151151
- ASP.NET
152152
status:
@@ -170,7 +170,7 @@ interactions:
170170
ParameterSetName:
171171
- --parameters
172172
User-Agent:
173-
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.26058-SP0)
173+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.8.10 (Windows-10-10.0.26100-SP0)
174174
method: POST
175175
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/getDnsResourceReference?api-version=2023-07-01-preview
176176
response:
@@ -184,7 +184,7 @@ interactions:
184184
content-type:
185185
- application/json; charset=utf-8
186186
date:
187-
- Wed, 06 Mar 2024 23:21:18 GMT
187+
- Tue, 19 Nov 2024 21:56:40 GMT
188188
strict-transport-security:
189189
- max-age=31536000; includeSubDomains
190190
x-cache:
@@ -194,7 +194,7 @@ interactions:
194194
x-ms-ratelimit-remaining-subscription-resource-requests:
195195
- '499'
196196
x-msedge-ref:
197-
- 'Ref A: 875CDF24A1B2490A8927D4EF71E737FE Ref B: CO6AA3150220009 Ref C: 2024-03-06T23:21:18Z'
197+
- 'Ref A: BD8B881D43A94CDA87CAD2D654B3F8B1 Ref B: CO6AA3150220037 Ref C: 2024-11-19T21:56:41Z'
198198
x-powered-by:
199199
- ASP.NET
200200
status:
@@ -214,12 +214,12 @@ interactions:
214214
ParameterSetName:
215215
- -g -z -n --remove
216216
User-Agent:
217-
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.26058-SP0)
217+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.8.10 (Windows-10-10.0.26100-SP0)
218218
method: GET
219219
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns_tmlink000001/providers/Microsoft.Network/dnsZones/mytestzone2.com/A/tmlink?api-version=2023-07-01-preview
220220
response:
221221
body:
222-
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com\/A\/tmlink","name":"tmlink","type":"Microsoft.Network\/dnszones\/A","etag":"b5691ecd-07d9-44d3-892a-6074efef6eff","properties":{"fqdn":"tmlink.mytestzone2.com.","TTL":30,"targetResource":{},"trafficManagementProfile":{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/trafficManagerProfiles\/tm2"},"provisioningState":"Succeeded"}}'
222+
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com\/A\/tmlink","name":"tmlink","type":"Microsoft.Network\/dnszones\/A","etag":"f0132a2a-8875-457f-bb4b-f240bf0db66d","properties":{"fqdn":"tmlink.mytestzone2.com.","TTL":30,"targetResource":{},"trafficManagementProfile":{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/trafficManagerProfiles\/tm2"},"provisioningState":"Succeeded"}}'
223223
headers:
224224
cache-control:
225225
- private
@@ -228,9 +228,9 @@ interactions:
228228
content-type:
229229
- application/json; charset=utf-8
230230
date:
231-
- Wed, 06 Mar 2024 23:21:19 GMT
231+
- Tue, 19 Nov 2024 21:56:42 GMT
232232
etag:
233-
- b5691ecd-07d9-44d3-892a-6074efef6eff
233+
- f0132a2a-8875-457f-bb4b-f240bf0db66d
234234
strict-transport-security:
235235
- max-age=31536000; includeSubDomains
236236
x-cache:
@@ -240,14 +240,14 @@ interactions:
240240
x-ms-ratelimit-remaining-subscription-resource-requests:
241241
- '499'
242242
x-msedge-ref:
243-
- 'Ref A: 89D7B44A77E44C24BFA9B7EF5D321922 Ref B: CO6AA3150217031 Ref C: 2024-03-06T23:21:20Z'
243+
- 'Ref A: 0EB166E1E1134F8D889CBABF5D655254 Ref B: CO6AA3150220053 Ref C: 2024-11-19T21:56:42Z'
244244
x-powered-by:
245245
- ASP.NET
246246
status:
247247
code: 200
248248
message: OK
249249
- request:
250-
body: '{"etag": "b5691ecd-07d9-44d3-892a-6074efef6eff", "properties": {"TTL":
250+
body: '{"etag": "f0132a2a-8875-457f-bb4b-f240bf0db66d", "properties": {"TTL":
251251
30}}'
252252
headers:
253253
Accept:
@@ -265,12 +265,12 @@ interactions:
265265
ParameterSetName:
266266
- -g -z -n --remove
267267
User-Agent:
268-
- AZURECLI/2.58.0 azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.26058-SP0)
268+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.8.10 (Windows-10-10.0.26100-SP0)
269269
method: PUT
270270
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dns_tmlink000001/providers/Microsoft.Network/dnsZones/mytestzone2.com/A/tmlink?api-version=2023-07-01-preview
271271
response:
272272
body:
273-
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com\/A\/tmlink","name":"tmlink","type":"Microsoft.Network\/dnszones\/A","etag":"c56fff03-50eb-4007-9213-af508e1293e4","properties":{"fqdn":"tmlink.mytestzone2.com.","TTL":30,"ARecords":[],"targetResource":{},"trafficManagementProfile":{},"provisioningState":"Succeeded"}}'
273+
string: '{"id":"\/subscriptions\/00000000-0000-0000-0000-000000000000\/resourceGroups\/cli_test_dns_tmlink000001\/providers\/Microsoft.Network\/dnszones\/mytestzone2.com\/A\/tmlink","name":"tmlink","type":"Microsoft.Network\/dnszones\/A","etag":"4a1d04e7-ac8c-4514-bc5f-3435e5937d8a","properties":{"fqdn":"tmlink.mytestzone2.com.","TTL":30,"ARecords":[],"targetResource":{},"trafficManagementProfile":{},"provisioningState":"Succeeded"}}'
274274
headers:
275275
cache-control:
276276
- private
@@ -279,9 +279,9 @@ interactions:
279279
content-type:
280280
- application/json; charset=utf-8
281281
date:
282-
- Wed, 06 Mar 2024 23:21:33 GMT
282+
- Tue, 19 Nov 2024 21:56:55 GMT
283283
etag:
284-
- c56fff03-50eb-4007-9213-af508e1293e4
284+
- 4a1d04e7-ac8c-4514-bc5f-3435e5937d8a
285285
strict-transport-security:
286286
- max-age=31536000; includeSubDomains
287287
x-cache:
@@ -291,7 +291,7 @@ interactions:
291291
x-ms-ratelimit-remaining-subscription-resource-requests:
292292
- '11999'
293293
x-msedge-ref:
294-
- 'Ref A: 4BC134037524485AAAF61AB9D898C3C2 Ref B: CO6AA3150217031 Ref C: 2024-03-06T23:21:20Z'
294+
- 'Ref A: 0D37EBF1D35A422EA202634C16B3C935 Ref B: CO6AA3150220053 Ref C: 2024-11-19T21:56:42Z'
295295
x-powered-by:
296296
- ASP.NET
297297
status:

0 commit comments

Comments
 (0)