diff --git a/src/cosmosdb-preview/HISTORY.rst b/src/cosmosdb-preview/HISTORY.rst index 1a15dc7918e..b2a1bde1168 100644 --- a/src/cosmosdb-preview/HISTORY.rst +++ b/src/cosmosdb-preview/HISTORY.rst @@ -1,6 +1,10 @@ .. :changelog: Release History =============== +1.2.1 +* 'az cosmosdb restore': Remove restore validations which would cause timeouts for large restore + ++++++++ 1.2.0 * Add support for Table RBAC role definition and assignment CRUD actions. diff --git a/src/cosmosdb-preview/azext_cosmosdb_preview/custom.py b/src/cosmosdb-preview/azext_cosmosdb_preview/custom.py index 9d6838ba6a6..0b1df2e6e25 100644 --- a/src/cosmosdb-preview/azext_cosmosdb_preview/custom.py +++ b/src/cosmosdb-preview/azext_cosmosdb_preview/custom.py @@ -1107,13 +1107,11 @@ def cli_cosmosdb_restore(cmd, if restore_timestamp_datetime_utc > current_dateTime: raise CLIError("Restore timestamp {} should be less than current timestamp {}".format(restore_timestamp_datetime_utc, current_dateTime)) - is_source_restorable_account_deleted = False for account in restorable_database_accounts_list: if account.account_name == account_name: if account.deletion_time is not None: if account.deletion_time >= restore_timestamp_datetime_utc >= account.creation_time: target_restorable_account = account - is_source_restorable_account_deleted = True break else: if restore_timestamp_datetime_utc >= account.creation_time: @@ -1123,62 +1121,6 @@ def cli_cosmosdb_restore(cmd, if target_restorable_account is None: raise CLIError("Cannot find a database account with name {} that is online at {}".format(account_name, restore_timestamp)) - # Validate if source account is empty only for live account restores. For deleted account restores the api will not work - if not is_source_restorable_account_deleted: - restorable_resources = None - api_type = target_restorable_account.api_type.lower() - arm_location_normalized = target_restorable_account.location.lower().replace(" ", "") - source_location = location - - if source_backup_location is not None: - source_location = source_backup_location - - if api_type == "sql": - try: - restorable_sql_resources_client = cf_restorable_sql_resources(cmd.cli_ctx, []) - restorable_resources = restorable_sql_resources_client.list( - arm_location_normalized, - target_restorable_account.name, - source_location, - restore_timestamp_datetime_utc) - except ResourceNotFoundError: - raise CLIError("Cannot find a database account with name {} that is online at {} in location {}".format(account_name, restore_timestamp, source_location)) - elif api_type == "mongodb": - try: - restorable_mongodb_resources_client = cf_restorable_mongodb_resources(cmd.cli_ctx, []) - restorable_resources = restorable_mongodb_resources_client.list( - arm_location_normalized, - target_restorable_account.name, - source_location, - restore_timestamp_datetime_utc) - except ResourceNotFoundError: - raise CLIError("Cannot find a database account with name {} that is online at {} in location {}".format(account_name, restore_timestamp, source_location)) - elif "sql" in api_type and "gremlin" in api_type: - try: - restorable_gremlin_resources_client = cf_restorable_gremlin_resources(cmd.cli_ctx, []) - restorable_resources = restorable_gremlin_resources_client.list( - arm_location_normalized, - target_restorable_account.name, - source_location, - restore_timestamp_datetime_utc) - except ResourceNotFoundError: - raise CLIError("Cannot find a database account with name {} that is online at {} in location {}".format(account_name, restore_timestamp, source_location)) - elif "sql" in api_type and "table" in api_type: - try: - restorable_table_resources_client = cf_restorable_table_resources(cmd.cli_ctx, []) - restorable_resources = restorable_table_resources_client.list( - arm_location_normalized, - target_restorable_account.name, - source_location, - restore_timestamp_datetime_utc) - except ResourceNotFoundError: - raise CLIError("Cannot find a database account with name {} that is online at {} in location {}".format(account_name, restore_timestamp, source_location)) - else: - raise CLIError("Provided API Type {} is not supported for account {}".format(target_restorable_account.api_type, account_name)) - - if restorable_resources is None or not any(restorable_resources): - raise CLIError("Database account {} contains no restorable resources in location {} at given restore timestamp {}".format(target_restorable_account, source_location, restore_timestamp_datetime_utc)) - # Trigger restore locations = [] locations.append(Location(location_name=location, failover_priority=0)) diff --git a/src/cosmosdb-preview/setup.py b/src/cosmosdb-preview/setup.py index 59e37c54ff6..0bbdeda51e9 100644 --- a/src/cosmosdb-preview/setup.py +++ b/src/cosmosdb-preview/setup.py @@ -16,7 +16,7 @@ # TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. -VERSION = '1.2.0' +VERSION = '1.2.1' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers