Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Datalake][Exception]Throw DataLakeAclChangeFailedError #14129

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
ArrowDialect,
ArrowType,
DataLakeFileQueryError,
DataLakeAclChangeFailedError,
AccessControlChangeResult,
AccessControlChangeCounters,
AccessControlChangeFailure,
Expand Down Expand Up @@ -84,6 +85,8 @@
'StorageStreamDownloader',
'DelimitedTextDialect',
'DelimitedJsonDialect',
'DataLakeFileQueryError',
'DataLakeAclChangeFailedError',
'ArrowDialect',
'ArrowType',
'DataLakeFileQueryError'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from azure.storage.blob import DelimitedTextDialect as BlobDelimitedTextDialect
from azure.storage.blob import DelimitedJsonDialect as BlobDelimitedJSON
from azure.storage.blob import ArrowDialect as BlobArrowDialect
from azure.storage.blob._generated.models import StorageErrorException
from azure.storage.blob._models import ContainerPropertiesPaged
from ._shared.models import DictMixin

Expand Down Expand Up @@ -649,3 +648,20 @@ def __init__(self, batch_counters, aggregate_counters, batch_failures, continuat
self.aggregate_counters = aggregate_counters
self.batch_failures = batch_failures
self.continuation = continuation


class DataLakeAclChangeFailedError(Exception):
"""The error happened during set/update/remove acl recursive operation.

:ivar ~azure.core.exceptions.AzureError error:
The exception.
:ivar str description:
A description of the error.
:ivar str continuation:
An opaque continuation token that may be used to resume the operations in case of failures.
"""

def __init__(self, error, description, continuation):
self.error = error
self.description = description
self.continuation = continuation
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

import six

from azure.core.exceptions import AzureError
from azure.storage.blob import BlobClient
from ._data_lake_lease import DataLakeLeaseClient
from ._deserialize import process_storage_error
from ._generated import DataLakeStorageClient
from ._generated.models import StorageErrorException
from ._models import LocationMode, DirectoryProperties, AccessControlChangeResult, AccessControlChanges, \
AccessControlChangeCounters, AccessControlChangeFailure
AccessControlChangeCounters, AccessControlChangeFailure, DataLakeAclChangeFailedError
from ._serialize import convert_dfs_url_to_blob_url, get_mod_conditions, \
get_path_http_headers, add_metadata_headers, get_lease_id, get_source_mod_conditions, get_access_conditions
from ._shared.base_client import StorageAccountHostsMixin, parse_query
Expand Down Expand Up @@ -612,8 +613,8 @@ def _set_access_control_internal(self, options, progress_hook, max_batches=None)
failure_count=total_failure_count),
continuation=last_continuation_token
if total_failure_count > 0 and not continue_on_failure else current_continuation_token)
except StorageErrorException as error:
process_storage_error(error)
except AzureError as error:
raise DataLakeAclChangeFailedError(error, error.message, last_continuation_token)

def _rename_path_options(self, rename_source, content_settings=None, metadata=None, **kwargs):
# type: (Optional[ContentSettings], Optional[Dict[str, str]], **Any) -> Dict[str, Any]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
# license information.
# --------------------------------------------------------------------------
# pylint: disable=invalid-overridden-method
from azure.core.exceptions import AzureError
from azure.storage.blob.aio import BlobClient
from .._shared.base_client_async import AsyncStorageAccountHostsMixin
from .._path_client import PathClient as PathClientBase
from .._models import DirectoryProperties, AccessControlChangeResult, AccessControlChangeFailure, \
AccessControlChangeCounters, AccessControlChanges
AccessControlChangeCounters, AccessControlChanges, DataLakeAclChangeFailedError
from .._generated.aio import DataLakeStorageClient
from ._data_lake_lease_async import DataLakeLeaseClient
from .._generated.models import StorageErrorException
Expand Down Expand Up @@ -474,8 +475,8 @@ async def _set_access_control_internal(self, options, progress_hook, max_batches
failure_count=total_failure_count),
continuation=last_continuation_token
if total_failure_count > 0 and not continue_on_failure else current_continuation_token)
except StorageErrorException as error:
process_storage_error(error)
except AzureError as error:
raise DataLakeAclChangeFailedError(error, error.message, last_continuation_token)

async def _rename_path(self, rename_source,
**kwargs):
Expand Down