Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/cosmosdb-preview/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
58 changes: 0 additions & 58 deletions src/cosmosdb-preview/azext_cosmosdb_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/cosmosdb-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading