Skip to content

Commit d8f42e3

Browse files
Update datasource type references for AKS and AzureBlob in backup instance update logic
1 parent 58c63cc commit d8f42e3

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/dataprotection/azext_dataprotection/manual/custom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,11 @@ def dataprotection_backup_instance_update(cmd, resource_group_name, vault_name,
269269
# Policy changes
270270
# - Updating the vaulted blob container list for vaulted blob backups
271271
# - Updating the backup datasource parameters for AKS backups
272-
datasource_type = backup_instance["properties"]["data_source_info"]["datasource_type"]
272+
datasource_type = backup_instance["properties"]["dataSourceInfo"]["datasourceType"]
273273

274274
# If user provided any of the datasource parameter update inputs, handle according to datasource type
275275
if vaulted_blob_container_list is not None or backup_configuration is not None:
276-
if datasource_type == "AzureKubernetesService":
276+
if datasource_type == "Microsoft.ContainerService/managedClusters":
277277
if vaulted_blob_container_list is not None:
278278
raise InvalidArgumentValueError('Invalid argument --vaulted-blob-container-list for given datasource type.')
279279
elif backup_configuration is not None:
@@ -286,7 +286,7 @@ def dataprotection_backup_instance_update(cmd, resource_group_name, vault_name,
286286
raise InvalidArgumentValueError("Provided --backup-configuration is not valid JSON")
287287
backup_instance['properties']['policyInfo']['policyParameters']['backupDatasourceParametersList'] = [backup_configuration]
288288

289-
elif datasource_type == "AzureBlob":
289+
elif datasource_type == "Microsoft.Storage/storageAccounts/blobServices":
290290
if backup_configuration is not None:
291291
raise InvalidArgumentValueError('Invalid argument --backup-configuration for given datasource type.')
292292
elif vaulted_blob_container_list is not None:

src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_instance_operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ def test_dataprotection_backup_instance_update_aks_configuration(test):
301301
new_backup_config_json = test.cmd('az dataprotection backup-instance initialize-backupconfig --datasource-type AzureKubernetesService').get_output_in_json()
302302

303303
# mutate a visible field to make the change observable
304-
new_backup_config_json['included_namespaces'] = ['nsA', 'nsB']
305-
new_backup_config_json['label_selectors'] = ['app=web']
306-
new_backup_config_json['excluded_resource_types'] = ['ResourceX']
304+
new_backup_config_json['included_namespaces'] = ["nsA", "nsB"]
305+
new_backup_config_json['label_selectors'] = ["app=web"]
306+
new_backup_config_json['excluded_resource_types'] = ["ResourceX"]
307307
new_backup_config_json['include_cluster_scope_resources'] = False
308308
new_backup_config_json['snapshot_volumes'] = False
309309
test.kwargs.update({

0 commit comments

Comments
 (0)