зеркало из https://github.com/microsoft/azure-cli.git
Add confirmation prompt to more delete operations (#1826)
* Add confirmation prompt to more delete operations - az appservice plan delete - az storage account delete - az vmss delete * Fix tests
This commit is contained in:
Родитель
9d407735c6
Коммит
96db2e6e36
|
@ -55,7 +55,7 @@ cli_command(__name__, 'appservice web deployment user show', 'azure.mgmt.web.ope
|
||||||
|
|
||||||
factory = lambda _: web_client_factory().server_farms
|
factory = lambda _: web_client_factory().server_farms
|
||||||
cli_command(__name__, 'appservice plan create', 'azure.cli.command_modules.appservice.custom#create_app_service_plan')
|
cli_command(__name__, 'appservice plan create', 'azure.cli.command_modules.appservice.custom#create_app_service_plan')
|
||||||
cli_command(__name__, 'appservice plan delete', 'azure.mgmt.web.operations.server_farms_operations#ServerFarmsOperations.delete_server_farm', factory)
|
cli_command(__name__, 'appservice plan delete', 'azure.mgmt.web.operations.server_farms_operations#ServerFarmsOperations.delete_server_farm', factory, confirmation=True)
|
||||||
cli_generic_update_command(__name__, 'appservice plan update', 'azure.mgmt.web.operations.server_farms_operations#ServerFarmsOperations.get_server_farm',
|
cli_generic_update_command(__name__, 'appservice plan update', 'azure.mgmt.web.operations.server_farms_operations#ServerFarmsOperations.get_server_farm',
|
||||||
'azure.mgmt.web.operations.server_farms_operations#ServerFarmsOperations.create_or_update_server_farm',
|
'azure.mgmt.web.operations.server_farms_operations#ServerFarmsOperations.create_or_update_server_farm',
|
||||||
custom_function_op='azure.cli.command_modules.appservice.custom#update_app_service_plan',
|
custom_function_op='azure.cli.command_modules.appservice.custom#update_app_service_plan',
|
||||||
|
|
|
@ -20,7 +20,7 @@ class BatchMgmtAccountScenarioTest(ResourceGroupVCRTestBase):
|
||||||
def tear_down(self):
|
def tear_down(self):
|
||||||
rg = self.resource_group
|
rg = self.resource_group
|
||||||
name = self.storage_account_name
|
name = self.storage_account_name
|
||||||
self.cmd('storage account delete -g {} -n {}'.format(rg, name))
|
self.cmd('storage account delete -g {} -n {} --force'.format(rg, name))
|
||||||
|
|
||||||
def __init__(self, test_method):
|
def __init__(self, test_method):
|
||||||
super(BatchMgmtAccountScenarioTest, self).__init__(__file__, test_method)
|
super(BatchMgmtAccountScenarioTest, self).__init__(__file__, test_method)
|
||||||
|
@ -124,7 +124,7 @@ class BatchMgmtApplicationScenarioTest(ResourceGroupVCRTestBase):
|
||||||
rg = self.resource_group
|
rg = self.resource_group
|
||||||
sname = self.storage_account_name
|
sname = self.storage_account_name
|
||||||
name = self.account_name
|
name = self.account_name
|
||||||
self.cmd('storage account delete -g {} -n {}'.format(rg, sname))
|
self.cmd('storage account delete -g {} -n {} --force'.format(rg, sname))
|
||||||
self.cmd('batch account delete -g {} -n {}'.format(rg, name))
|
self.cmd('batch account delete -g {} -n {}'.format(rg, name))
|
||||||
if os.path.exists(self.package_file_name):
|
if os.path.exists(self.package_file_name):
|
||||||
os.remove(self.package_file_name)
|
os.remove(self.package_file_name)
|
||||||
|
|
|
@ -28,7 +28,7 @@ from azure.cli.command_modules.storage._format import \
|
||||||
# storage account commands
|
# storage account commands
|
||||||
factory = lambda kwargs: storage_client_factory().storage_accounts # noqa: E731 lambda vs def
|
factory = lambda kwargs: storage_client_factory().storage_accounts # noqa: E731 lambda vs def
|
||||||
cli_command(__name__, 'storage account check-name', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.check_name_availability', factory)
|
cli_command(__name__, 'storage account check-name', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.check_name_availability', factory)
|
||||||
cli_command(__name__, 'storage account delete', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.delete', factory)
|
cli_command(__name__, 'storage account delete', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.delete', factory, confirmation=True)
|
||||||
cli_command(__name__, 'storage account show', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.get_properties', factory)
|
cli_command(__name__, 'storage account show', 'azure.mgmt.storage.operations.storage_accounts_operations#StorageAccountsOperations.get_properties', factory)
|
||||||
cli_command(__name__, 'storage account create', 'azure.cli.command_modules.storage.custom#create_storage_account')
|
cli_command(__name__, 'storage account create', 'azure.cli.command_modules.storage.custom#create_storage_account')
|
||||||
cli_command(__name__, 'storage account list', 'azure.cli.command_modules.storage.custom#list_storage_accounts')
|
cli_command(__name__, 'storage account list', 'azure.cli.command_modules.storage.custom#list_storage_accounts')
|
||||||
|
|
|
@ -92,7 +92,7 @@ class StorageAccountScenarioTest(ResourceGroupVCRTestBase):
|
||||||
checks=JMESPathCheck('tags', {}))
|
checks=JMESPathCheck('tags', {}))
|
||||||
s.cmd('storage account update -g {} -n {} --sku Standard_GRS'.format(rg, account),
|
s.cmd('storage account update -g {} -n {} --sku Standard_GRS'.format(rg, account),
|
||||||
checks=JMESPathCheck('sku.name', 'Standard_GRS'))
|
checks=JMESPathCheck('sku.name', 'Standard_GRS'))
|
||||||
s.cmd('storage account delete -g {} -n {}'.format(rg, account))
|
s.cmd('storage account delete -g {} -n {} --force'.format(rg, account))
|
||||||
s.cmd('storage account check-name --name {}'.format(account), checks=JMESPathCheck('nameAvailable', True))
|
s.cmd('storage account check-name --name {}'.format(account), checks=JMESPathCheck('nameAvailable', True))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ cli_command(__name__, 'vm list-usage', mgmt_path.format('usage_operations', 'Usa
|
||||||
cli_command(__name__, 'vmss create', 'azure.cli.command_modules.vm.mgmt_vmss.lib.operations.vmss_operations#VmssOperations.create_or_update', cf_vmss_create,
|
cli_command(__name__, 'vmss create', 'azure.cli.command_modules.vm.mgmt_vmss.lib.operations.vmss_operations#VmssOperations.create_or_update', cf_vmss_create,
|
||||||
transform=DeploymentOutputLongRunningOperation('Starting vmss create'))
|
transform=DeploymentOutputLongRunningOperation('Starting vmss create'))
|
||||||
|
|
||||||
cli_command(__name__, 'vmss delete', mgmt_path.format('virtual_machine_scale_sets_operations', 'VirtualMachineScaleSetsOperations', 'delete'), cf_vmss)
|
cli_command(__name__, 'vmss delete', mgmt_path.format('virtual_machine_scale_sets_operations', 'VirtualMachineScaleSetsOperations', 'delete'), cf_vmss, confirmation=True)
|
||||||
cli_command(__name__, 'vmss list-skus', mgmt_path.format('virtual_machine_scale_sets_operations', 'VirtualMachineScaleSetsOperations', 'list_skus'), cf_vmss)
|
cli_command(__name__, 'vmss list-skus', mgmt_path.format('virtual_machine_scale_sets_operations', 'VirtualMachineScaleSetsOperations', 'list_skus'), cf_vmss)
|
||||||
|
|
||||||
cli_command(__name__, 'vmss list-instances', mgmt_path.format('virtual_machine_scale_set_vms_operations', 'VirtualMachineScaleSetVMsOperations', 'list'), cf_vmss_vm)
|
cli_command(__name__, 'vmss list-instances', mgmt_path.format('virtual_machine_scale_set_vms_operations', 'VirtualMachineScaleSetVMsOperations', 'list'), cf_vmss_vm)
|
||||||
|
|
|
@ -687,7 +687,7 @@ class VMScaleSetDeleteScenarioTest(VCRTestBase):
|
||||||
])
|
])
|
||||||
self.cmd('vmss deallocate --resource-group {} --name {}'.format(self.resource_group, self.ss_name),
|
self.cmd('vmss deallocate --resource-group {} --name {}'.format(self.resource_group, self.ss_name),
|
||||||
checks=NoneCheck())
|
checks=NoneCheck())
|
||||||
self.cmd('vmss delete --resource-group {} --name {}'.format(self.resource_group, self.ss_name),
|
self.cmd('vmss delete --resource-group {} --name {} --force'.format(self.resource_group, self.ss_name),
|
||||||
checks=NoneCheck())
|
checks=NoneCheck())
|
||||||
self.cmd('vmss list --resource-group {}'.format(self.resource_group),
|
self.cmd('vmss list --resource-group {}'.format(self.resource_group),
|
||||||
checks=NoneCheck())
|
checks=NoneCheck())
|
||||||
|
|
Загрузка…
Ссылка в новой задаче