[Storage] Fix issue #15600: az storage fs exists: in case fs does not exist ResourceNotFoundError is returned (#15643)

This commit is contained in:
Zunli Hu 2020-10-30 12:29:25 +08:00 коммит произвёл GitHub
Родитель d8d95f9192
Коммит 533e55ae59
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 85 добавлений и 46 удалений

Просмотреть файл

@ -15,5 +15,5 @@ def exists(cmd, client, timeout=None):
from azure.cli.command_modules.storage.track2_util import _dont_fail_on_exist
StorageErrorCode = cmd.get_models("_shared.models#StorageErrorCode",
resource_type=ResourceType.DATA_STORAGE_FILEDATALAKE)
_dont_fail_on_exist(ex, StorageErrorCode.blob_not_found)
_dont_fail_on_exist(ex, StorageErrorCode.container_not_found)
return False

Просмотреть файл

@ -16,7 +16,7 @@ interactions:
- -n -g --query -o
User-Agent:
- python/3.7.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-storage/11.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
azure-mgmt-storage/11.2.0 Azure-SDK-For-Python AZURECLI/2.14.0
accept-language:
- en-US
method: POST
@ -32,7 +32,7 @@ interactions:
content-type:
- application/json
date:
- Mon, 19 Oct 2020 05:45:04 GMT
- Fri, 23 Oct 2020 09:17:19 GMT
expires:
- '-1'
pragma:
@ -69,7 +69,7 @@ interactions:
- -n -g -o
User-Agent:
- python/3.7.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-storage/11.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
azure-mgmt-storage/11.2.0 Azure-SDK-For-Python AZURECLI/2.14.0
accept-language:
- en-US
method: POST
@ -85,7 +85,7 @@ interactions:
content-type:
- application/json
date:
- Mon, 19 Oct 2020 05:45:05 GMT
- Fri, 23 Oct 2020 09:17:20 GMT
expires:
- '-1'
pragma:
@ -101,10 +101,47 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-resource-requests:
- '11999'
- '11998'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Fri, 23 Oct 2020 09:17:21 GMT
x-ms-version:
- '2020-02-10'
method: GET
uri: https://clitest000002.blob.core.windows.net/filesystem000003?restype=container
response:
body:
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>ContainerNotFound</Code><Message>The
specified container does not exist.\nRequestId:adcba596-e01e-0067-7d1d-a9a4af000000\nTime:2020-10-23T09:17:24.1007288Z</Message></Error>"
headers:
content-length:
- '225'
content-type:
- application/xml
date:
- Fri, 23 Oct 2020 09:17:23 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-error-code:
- ContainerNotFound
x-ms-version:
- '2020-02-10'
status:
code: 404
message: The specified container does not exist.
- request:
body: null
headers:
@ -121,7 +158,7 @@ interactions:
x-ms-blob-public-access:
- blob
x-ms-date:
- Mon, 19 Oct 2020 05:45:06 GMT
- Fri, 23 Oct 2020 09:17:24 GMT
x-ms-version:
- '2020-02-10'
method: PUT
@ -133,11 +170,11 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:09 GMT
- Fri, 23 Oct 2020 09:17:25 GMT
etag:
- '"0x8D873F223B040FC"'
- '"0x8D8773474AA9EF0"'
last-modified:
- Mon, 19 Oct 2020 05:45:09 GMT
- Fri, 23 Oct 2020 09:17:25 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
@ -157,7 +194,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:09 GMT
- Fri, 23 Oct 2020 09:17:25 GMT
x-ms-version:
- '2020-02-10'
method: GET
@ -169,11 +206,11 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:09 GMT
- Fri, 23 Oct 2020 09:17:26 GMT
etag:
- '"0x8D873F223B040FC"'
- '"0x8D8773474AA9EF0"'
last-modified:
- Mon, 19 Oct 2020 05:45:09 GMT
- Fri, 23 Oct 2020 09:17:25 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-blob-public-access:
@ -207,7 +244,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:10 GMT
- Fri, 23 Oct 2020 09:17:26 GMT
x-ms-version:
- '2020-02-10'
method: GET
@ -219,11 +256,11 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:11 GMT
- Fri, 23 Oct 2020 09:17:26 GMT
etag:
- '"0x8D873F223B040FC"'
- '"0x8D8773474AA9EF0"'
last-modified:
- Mon, 19 Oct 2020 05:45:09 GMT
- Fri, 23 Oct 2020 09:17:25 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-blob-public-access:
@ -261,7 +298,7 @@ interactions:
x-ms-blob-public-access:
- container
x-ms-date:
- Mon, 19 Oct 2020 05:45:11 GMT
- Fri, 23 Oct 2020 09:17:27 GMT
x-ms-version:
- '2020-02-10'
method: PUT
@ -273,11 +310,11 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:12 GMT
- Fri, 23 Oct 2020 09:17:28 GMT
etag:
- '"0x8D873F225D74641"'
- '"0x8D8773476C2317B"'
last-modified:
- Mon, 19 Oct 2020 05:45:12 GMT
- Fri, 23 Oct 2020 09:17:28 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
@ -297,7 +334,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:12 GMT
- Fri, 23 Oct 2020 09:17:28 GMT
x-ms-version:
- '2020-02-10'
method: GET
@ -309,11 +346,11 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:12 GMT
- Fri, 23 Oct 2020 09:17:29 GMT
etag:
- '"0x8D873F225D74641"'
- '"0x8D8773476C2317B"'
last-modified:
- Mon, 19 Oct 2020 05:45:12 GMT
- Fri, 23 Oct 2020 09:17:28 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-blob-public-access:
@ -349,7 +386,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:13 GMT
- Fri, 23 Oct 2020 09:17:30 GMT
x-ms-version:
- '2020-02-10'
method: PUT
@ -361,11 +398,11 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:14 GMT
- Fri, 23 Oct 2020 09:17:30 GMT
etag:
- '"0x8D873F2272DCC98"'
- '"0x8D87734781D81E1"'
last-modified:
- Mon, 19 Oct 2020 05:45:14 GMT
- Fri, 23 Oct 2020 09:17:31 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
@ -385,7 +422,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:15 GMT
- Fri, 23 Oct 2020 09:17:31 GMT
x-ms-version:
- '2020-02-10'
method: GET
@ -397,11 +434,11 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:15 GMT
- Fri, 23 Oct 2020 09:17:31 GMT
etag:
- '"0x8D873F2272DCC98"'
- '"0x8D87734781D81E1"'
last-modified:
- Mon, 19 Oct 2020 05:45:14 GMT
- Fri, 23 Oct 2020 09:17:31 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-default-encryption-scope:
@ -433,7 +470,7 @@ interactions:
User-Agent:
- azsdk-python-storage-blob/12.6.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:16 GMT
- Fri, 23 Oct 2020 09:17:32 GMT
x-ms-version:
- '2020-02-10'
method: GET
@ -441,16 +478,16 @@ interactions:
response:
body:
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><EnumerationResults
ServiceEndpoint=\"https://clitest000002.blob.core.windows.net/\"><Containers><Container><Name>filesystem000003</Name><Properties><Last-Modified>Mon,
19 Oct 2020 05:45:09 GMT</Last-Modified><Etag>\"0x8D873F223B040FC\"</Etag><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><PublicAccess>blob</PublicAccess><DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope><DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride><HasImmutabilityPolicy>false</HasImmutabilityPolicy><HasLegalHold>false</HasLegalHold></Properties></Container><Container><Name>filesystem000004</Name><Properties><Last-Modified>Mon,
19 Oct 2020 05:45:12 GMT</Last-Modified><Etag>\"0x8D873F225D74641\"</Etag><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><PublicAccess>container</PublicAccess><DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope><DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride><HasImmutabilityPolicy>false</HasImmutabilityPolicy><HasLegalHold>false</HasLegalHold></Properties></Container><Container><Name>filesystem000005</Name><Properties><Last-Modified>Mon,
19 Oct 2020 05:45:14 GMT</Last-Modified><Etag>\"0x8D873F2272DCC98\"</Etag><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope><DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride><HasImmutabilityPolicy>false</HasImmutabilityPolicy><HasLegalHold>false</HasLegalHold></Properties></Container></Containers><NextMarker
ServiceEndpoint=\"https://clitest000002.blob.core.windows.net/\"><Containers><Container><Name>filesystem000003</Name><Properties><Last-Modified>Fri,
23 Oct 2020 09:17:25 GMT</Last-Modified><Etag>\"0x8D8773474AA9EF0\"</Etag><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><PublicAccess>blob</PublicAccess><DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope><DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride><HasImmutabilityPolicy>false</HasImmutabilityPolicy><HasLegalHold>false</HasLegalHold></Properties></Container><Container><Name>filesystem000004</Name><Properties><Last-Modified>Fri,
23 Oct 2020 09:17:28 GMT</Last-Modified><Etag>\"0x8D8773476C2317B\"</Etag><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><PublicAccess>container</PublicAccess><DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope><DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride><HasImmutabilityPolicy>false</HasImmutabilityPolicy><HasLegalHold>false</HasLegalHold></Properties></Container><Container><Name>filesystem000005</Name><Properties><Last-Modified>Fri,
23 Oct 2020 09:17:31 GMT</Last-Modified><Etag>\"0x8D87734781D81E1\"</Etag><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope><DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride><HasImmutabilityPolicy>false</HasImmutabilityPolicy><HasLegalHold>false</HasLegalHold></Properties></Container></Containers><NextMarker
/></EnumerationResults>"
headers:
content-type:
- application/xml
date:
- Mon, 19 Oct 2020 05:45:17 GMT
- Fri, 23 Oct 2020 09:17:32 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
@ -474,7 +511,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:17 GMT
- Fri, 23 Oct 2020 09:17:33 GMT
x-ms-version:
- '2020-02-10'
method: DELETE
@ -486,7 +523,7 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:18 GMT
- Fri, 23 Oct 2020 09:17:33 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
@ -508,7 +545,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:19 GMT
- Fri, 23 Oct 2020 09:17:34 GMT
x-ms-version:
- '2020-02-10'
method: DELETE
@ -520,7 +557,7 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:19 GMT
- Fri, 23 Oct 2020 09:17:34 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
@ -542,7 +579,7 @@ interactions:
User-Agent:
- azsdk-python-storage-dfs/12.2.0b1 Python/3.7.7 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Mon, 19 Oct 2020 05:45:20 GMT
- Fri, 23 Oct 2020 09:17:35 GMT
x-ms-version:
- '2020-02-10'
method: DELETE
@ -554,7 +591,7 @@ interactions:
content-length:
- '0'
date:
- Mon, 19 Oct 2020 05:45:21 GMT
- Fri, 23 Oct 2020 09:17:36 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:

Просмотреть файл

@ -228,6 +228,8 @@ class StorageADLSGen2Tests(StorageScenarioMixin, ScenarioTest):
# Test with account key
filesystem1 = self.create_random_name(prefix='filesystem', length=24)
self.storage_cmd('storage fs exists -n {}', account_info, filesystem1) \
.assert_with_checks(JMESPathCheck('exists', False))
self.storage_cmd('storage fs create -n {} --public-access file', account_info, filesystem1)
self.storage_cmd('storage fs exists -n {}', account_info, filesystem1) \
.assert_with_checks(JMESPathCheck('exists', True))