Skip to content

Commit 0aa924a

Browse files
authored
[DataLake][Fix]only set recursive=True for delete directory (#17671)
* [DataLake][Fix]only set recursive=True for delete directory * re-record
1 parent 10bc4e8 commit 0aa924a

File tree

7 files changed

+165
-122
lines changed

7 files changed

+165
-122
lines changed

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_directory_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def delete_directory(self, **kwargs):
200200
:dedent: 4
201201
:caption: Delete directory.
202202
"""
203-
return self._delete(**kwargs)
203+
return self._delete(recursive=True, **kwargs)
204204

205205
def get_directory_properties(self, **kwargs):
206206
# type: (**Any) -> DirectoryProperties

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_path_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ def _delete_path_options(**kwargs):
210210
mod_conditions = get_mod_conditions(kwargs)
211211

212212
options = {
213-
'recursive': True,
214213
'lease_access_conditions': access_conditions,
215214
'modified_access_conditions': mod_conditions,
216215
'timeout': kwargs.pop('timeout', None)}

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async def delete_directory(self, **kwargs):
180180
:dedent: 4
181181
:caption: Delete directory.
182182
"""
183-
return await self._delete(**kwargs)
183+
return await self._delete(recursive=True, **kwargs)
184184

185185
async def get_directory_properties(self, **kwargs):
186186
# type: (**Any) -> DirectoryProperties

sdk/storage/azure-storage-file-datalake/tests/recordings/test_file.test_delete_file.yaml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ interactions:
33
body: null
44
headers:
55
Accept:
6-
- '*/*'
6+
- application/json
77
Accept-Encoding:
88
- gzip, deflate
99
Connection:
1010
- keep-alive
1111
Content-Length:
1212
- '0'
1313
User-Agent:
14-
- azsdk-python-storage-dfs/12.0.0b1 Python/3.7.3 (Windows-10-10.0.18362-SP0)
14+
- azsdk-python-storage-dfs/12.3.0 Python/3.7.3 (Windows-10-10.0.19041-SP0)
1515
x-ms-client-request-id:
16-
- d678b5ac-ff4f-11e9-a1bc-001a7dda7113
16+
- ae6092c8-919b-11eb-8e3b-001a7dda7113
1717
x-ms-date:
18-
- Mon, 04 Nov 2019 22:09:57 GMT
18+
- Tue, 30 Mar 2021 21:05:39 GMT
1919
x-ms-properties:
2020
- ''
2121
x-ms-version:
22-
- '2019-02-02'
22+
- '2020-02-10'
2323
method: PUT
2424
uri: https://storagename.dfs.core.windows.net/filesystem8e4f0a7f/file8e4f0a7f?resource=file
2525
response:
@@ -29,93 +29,97 @@ interactions:
2929
Content-Length:
3030
- '0'
3131
Date:
32-
- Mon, 04 Nov 2019 22:09:57 GMT
32+
- Tue, 30 Mar 2021 21:05:39 GMT
3333
ETag:
34-
- '"0x8D76173BAD1A249"'
34+
- '"0x8D8F3BF92C89616"'
3535
Last-Modified:
36-
- Mon, 04 Nov 2019 22:09:57 GMT
36+
- Tue, 30 Mar 2021 21:05:39 GMT
3737
Server:
3838
- Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0
3939
x-ms-request-id:
40-
- fe48fce5-901f-001d-175c-934028000000
40+
- 611634be-a01f-0006-5ea8-257e2b000000
4141
x-ms-version:
42-
- '2019-02-02'
42+
- '2020-02-10'
4343
status:
4444
code: 201
4545
message: Created
4646
- request:
4747
body: null
4848
headers:
4949
Accept:
50-
- '*/*'
50+
- application/json
5151
Accept-Encoding:
5252
- gzip, deflate
5353
Connection:
5454
- keep-alive
5555
Content-Length:
5656
- '0'
5757
User-Agent:
58-
- azsdk-python-storage-dfs/12.0.0b1 Python/3.7.3 (Windows-10-10.0.18362-SP0)
58+
- azsdk-python-storage-dfs/12.3.0 Python/3.7.3 (Windows-10-10.0.19041-SP0)
5959
x-ms-client-request-id:
60-
- d6a4d778-ff4f-11e9-8498-001a7dda7113
60+
- ae9c7f12-919b-11eb-96c4-001a7dda7113
6161
x-ms-date:
62-
- Mon, 04 Nov 2019 22:09:58 GMT
62+
- Tue, 30 Mar 2021 21:05:40 GMT
6363
x-ms-version:
64-
- '2019-02-02'
64+
- '2020-02-10'
6565
method: DELETE
66-
uri: https://storagename.dfs.core.windows.net/filesystem8e4f0a7f/file8e4f0a7f?recursive=true
66+
uri: https://storagename.dfs.core.windows.net/filesystem8e4f0a7f/file8e4f0a7f
6767
response:
6868
body:
6969
string: ''
7070
headers:
7171
Content-Length:
7272
- '0'
7373
Date:
74-
- Mon, 04 Nov 2019 22:09:57 GMT
74+
- Tue, 30 Mar 2021 21:05:39 GMT
7575
Server:
7676
- Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0
7777
x-ms-request-id:
78-
- fe48fce6-901f-001d-185c-934028000000
78+
- 611634bf-a01f-0006-5fa8-257e2b000000
7979
x-ms-version:
80-
- '2019-02-02'
80+
- '2020-02-10'
8181
status:
8282
code: 200
8383
message: OK
8484
- request:
8585
body: null
8686
headers:
8787
Accept:
88-
- '*/*'
88+
- application/xml
8989
Accept-Encoding:
9090
- gzip, deflate
9191
Connection:
9292
- keep-alive
9393
User-Agent:
94-
- azsdk-python-storage-dfs/12.0.0b1 Python/3.7.3 (Windows-10-10.0.18362-SP0)
94+
- azsdk-python-storage-dfs/12.3.0 Python/3.7.3 (Windows-10-10.0.19041-SP0)
9595
x-ms-client-request-id:
96-
- d6b06970-ff4f-11e9-bd88-001a7dda7113
96+
- aeb12126-919b-11eb-9177-001a7dda7113
9797
x-ms-date:
98-
- Mon, 04 Nov 2019 22:09:58 GMT
98+
- Tue, 30 Mar 2021 21:05:40 GMT
99+
x-ms-encryption-algorithm:
100+
- AES256
99101
x-ms-version:
100-
- '2019-02-02'
102+
- '2020-06-12'
101103
method: HEAD
102104
uri: https://storagename.blob.core.windows.net/filesystem8e4f0a7f/file8e4f0a7f
103105
response:
104106
body:
105107
string: ''
106108
headers:
107109
Date:
108-
- Mon, 04 Nov 2019 22:09:58 GMT
110+
- Tue, 30 Mar 2021 21:05:39 GMT
109111
Server:
110112
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
111113
Transfer-Encoding:
112114
- chunked
115+
Vary:
116+
- Origin
113117
x-ms-error-code:
114118
- BlobNotFound
115119
x-ms-request-id:
116-
- 407d0848-e01e-004a-0f5c-93ee1b000000
120+
- 26282111-c01e-0072-0ca8-254adb000000
117121
x-ms-version:
118-
- '2019-02-02'
122+
- '2020-06-12'
119123
status:
120124
code: 404
121125
message: The specified blob does not exist.

sdk/storage/azure-storage-file-datalake/tests/recordings/test_file.test_delete_file_with_if_unmodified_since.yaml

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ interactions:
33
body: null
44
headers:
55
Accept:
6-
- '*/*'
6+
- application/json
77
Accept-Encoding:
88
- gzip, deflate
99
Connection:
1010
- keep-alive
1111
Content-Length:
1212
- '0'
1313
User-Agent:
14-
- azsdk-python-storage-dfs/12.0.0b5 Python/3.7.3 (Windows-10-10.0.18362-SP0)
14+
- azsdk-python-storage-dfs/12.3.0 Python/3.7.3 (Windows-10-10.0.19041-SP0)
1515
x-ms-client-request-id:
16-
- e17c0728-16b1-11ea-ac34-001a7dda7113
16+
- 5f624194-919b-11eb-b8b4-001a7dda7113
1717
x-ms-date:
18-
- Wed, 04 Dec 2019 16:19:43 GMT
18+
- Tue, 30 Mar 2021 21:03:27 GMT
1919
x-ms-properties:
2020
- ''
2121
x-ms-version:
22-
- '2019-02-02'
22+
- '2020-02-10'
2323
method: PUT
2424
uri: https://storagename.dfs.core.windows.net/filesystem1a9514bc/file1a9514bc?resource=file
2525
response:
@@ -29,37 +29,39 @@ interactions:
2929
Content-Length:
3030
- '0'
3131
Date:
32-
- Wed, 04 Dec 2019 16:19:42 GMT
32+
- Tue, 30 Mar 2021 21:03:27 GMT
3333
ETag:
34-
- '"0x8D778D5C5E1D782"'
34+
- '"0x8D8F3BF43CFDA79"'
3535
Last-Modified:
36-
- Wed, 04 Dec 2019 16:19:43 GMT
36+
- Tue, 30 Mar 2021 21:03:27 GMT
3737
Server:
3838
- Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0
3939
x-ms-request-id:
40-
- da9cdde4-001f-001f-70be-aafe90000000
40+
- fc780d80-801f-003e-2da8-25daeb000000
4141
x-ms-version:
42-
- '2019-02-02'
42+
- '2020-02-10'
4343
status:
4444
code: 201
4545
message: Created
4646
- request:
4747
body: null
4848
headers:
4949
Accept:
50-
- '*/*'
50+
- application/xml
5151
Accept-Encoding:
5252
- gzip, deflate
5353
Connection:
5454
- keep-alive
5555
User-Agent:
56-
- azsdk-python-storage-dfs/12.0.0b5 Python/3.7.3 (Windows-10-10.0.18362-SP0)
56+
- azsdk-python-storage-dfs/12.3.0 Python/3.7.3 (Windows-10-10.0.19041-SP0)
5757
x-ms-client-request-id:
58-
- e1c13306-16b1-11ea-8f97-001a7dda7113
58+
- 5fa38aa4-919b-11eb-accc-001a7dda7113
5959
x-ms-date:
60-
- Wed, 04 Dec 2019 16:19:44 GMT
60+
- Tue, 30 Mar 2021 21:03:27 GMT
61+
x-ms-encryption-algorithm:
62+
- AES256
6163
x-ms-version:
62-
- '2019-02-02'
64+
- '2020-06-12'
6365
method: HEAD
6466
uri: https://storagename.blob.core.windows.net/filesystem1a9514bc/file1a9514bc
6567
response:
@@ -73,109 +75,121 @@ interactions:
7375
Content-Type:
7476
- application/octet-stream
7577
Date:
76-
- Wed, 04 Dec 2019 16:19:43 GMT
78+
- Tue, 30 Mar 2021 21:03:27 GMT
7779
ETag:
78-
- '"0x8D778D5C5E1D782"'
80+
- '"0x8D8F3BF43CFDA79"'
7981
Last-Modified:
80-
- Wed, 04 Dec 2019 16:19:43 GMT
82+
- Tue, 30 Mar 2021 21:03:27 GMT
8183
Server:
8284
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
85+
Vary:
86+
- Origin
8387
x-ms-access-tier:
8488
- Hot
8589
x-ms-access-tier-inferred:
8690
- 'true'
8791
x-ms-blob-type:
8892
- BlockBlob
8993
x-ms-creation-time:
90-
- Wed, 04 Dec 2019 16:19:43 GMT
94+
- Tue, 30 Mar 2021 21:03:27 GMT
95+
x-ms-group:
96+
- $superuser
9197
x-ms-lease-state:
9298
- available
9399
x-ms-lease-status:
94100
- unlocked
101+
x-ms-owner:
102+
- $superuser
103+
x-ms-permissions:
104+
- rw-r-----
95105
x-ms-request-id:
96-
- 90f47a8a-401e-001e-1ebe-aaa14c000000
106+
- 74514c16-701e-0015-46a8-255a27000000
97107
x-ms-server-encrypted:
98108
- 'true'
99109
x-ms-version:
100-
- '2019-02-02'
110+
- '2020-06-12'
101111
status:
102112
code: 200
103113
message: OK
104114
- request:
105115
body: null
106116
headers:
107117
Accept:
108-
- '*/*'
118+
- application/json
109119
Accept-Encoding:
110120
- gzip, deflate
111121
Connection:
112122
- keep-alive
113123
Content-Length:
114124
- '0'
115125
If-Unmodified-Since:
116-
- Wed, 04 Dec 2019 16:19:43 GMT
126+
- Tue, 30 Mar 2021 21:03:27 GMT
117127
User-Agent:
118-
- azsdk-python-storage-dfs/12.0.0b5 Python/3.7.3 (Windows-10-10.0.18362-SP0)
128+
- azsdk-python-storage-dfs/12.3.0 Python/3.7.3 (Windows-10-10.0.19041-SP0)
119129
x-ms-client-request-id:
120-
- e1f365cc-16b1-11ea-9fb1-001a7dda7113
130+
- 5fe3ddee-919b-11eb-ac10-001a7dda7113
121131
x-ms-date:
122-
- Wed, 04 Dec 2019 16:19:44 GMT
132+
- Tue, 30 Mar 2021 21:03:27 GMT
123133
x-ms-version:
124-
- '2019-02-02'
134+
- '2020-02-10'
125135
method: DELETE
126-
uri: https://storagename.dfs.core.windows.net/filesystem1a9514bc/file1a9514bc?recursive=true
136+
uri: https://storagename.dfs.core.windows.net/filesystem1a9514bc/file1a9514bc
127137
response:
128138
body:
129139
string: ''
130140
headers:
131141
Content-Length:
132142
- '0'
133143
Date:
134-
- Wed, 04 Dec 2019 16:19:43 GMT
144+
- Tue, 30 Mar 2021 21:03:27 GMT
135145
Server:
136146
- Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0
137147
x-ms-request-id:
138-
- da9cdde5-001f-001f-71be-aafe90000000
148+
- fc780d90-801f-003e-3ca8-25daeb000000
139149
x-ms-version:
140-
- '2019-02-02'
150+
- '2020-02-10'
141151
status:
142152
code: 200
143153
message: OK
144154
- request:
145155
body: null
146156
headers:
147157
Accept:
148-
- '*/*'
158+
- application/xml
149159
Accept-Encoding:
150160
- gzip, deflate
151161
Connection:
152162
- keep-alive
153163
User-Agent:
154-
- azsdk-python-storage-dfs/12.0.0b5 Python/3.7.3 (Windows-10-10.0.18362-SP0)
164+
- azsdk-python-storage-dfs/12.3.0 Python/3.7.3 (Windows-10-10.0.19041-SP0)
155165
x-ms-client-request-id:
156-
- e201e1c6-16b1-11ea-bcaf-001a7dda7113
166+
- 5ff6b90a-919b-11eb-a103-001a7dda7113
157167
x-ms-date:
158-
- Wed, 04 Dec 2019 16:19:44 GMT
168+
- Tue, 30 Mar 2021 21:03:28 GMT
169+
x-ms-encryption-algorithm:
170+
- AES256
159171
x-ms-version:
160-
- '2019-02-02'
172+
- '2020-06-12'
161173
method: HEAD
162174
uri: https://storagename.blob.core.windows.net/filesystem1a9514bc/file1a9514bc
163175
response:
164176
body:
165177
string: ''
166178
headers:
167179
Date:
168-
- Wed, 04 Dec 2019 16:19:43 GMT
180+
- Tue, 30 Mar 2021 21:03:27 GMT
169181
Server:
170182
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
171183
Transfer-Encoding:
172184
- chunked
185+
Vary:
186+
- Origin
173187
x-ms-error-code:
174188
- BlobNotFound
175189
x-ms-request-id:
176-
- 90f47b00-401e-001e-0bbe-aaa14c000000
190+
- 74514d0a-701e-0015-28a8-255a27000000
177191
x-ms-version:
178-
- '2019-02-02'
192+
- '2020-06-12'
179193
status:
180194
code: 404
181195
message: The specified blob does not exist.

0 commit comments

Comments
 (0)