diff --git a/src/spring/HISTORY.md b/src/spring/HISTORY.md index 6ced91459dd..42bc7898935 100644 --- a/src/spring/HISTORY.md +++ b/src/spring/HISTORY.md @@ -1,5 +1,9 @@ Release History =============== +1.6.5 +--- +* Add argument `--deployment-name` in command `az spring app create`. + 1.6.4 --- * Add new commands `az spring application-configuration-service create` and `az spring application-configuration-service delete`. diff --git a/src/spring/azext_spring/_params.py b/src/spring/azext_spring/_params.py index a7dc52ebbc8..f6c25b9f2d8 100644 --- a/src/spring/azext_spring/_params.py +++ b/src/spring/azext_spring/_params.py @@ -267,6 +267,8 @@ def load_arguments(self, _): help='A json file path for the persistent storages to be mounted to the app') c.argument('loaded_public_certificate_file', options_list=['--loaded-public-certificate-file', '-f'], type=str, help='A json file path indicates the certificates which would be loaded to app') + c.argument('deployment_name', default='default', + help='Name of the default deployment.', validator=validate_name) with self.argument_context('spring app update') as c: c.argument('assign_endpoint', arg_type=get_three_state_flag(), diff --git a/src/spring/azext_spring/app.py b/src/spring/azext_spring/app.py index 54841ef88f6..ec9b97732ca 100644 --- a/src/spring/azext_spring/app.py +++ b/src/spring/azext_spring/app.py @@ -35,6 +35,7 @@ def app_create(cmd, client, resource_group, service, name, + deployment_name=None, # deployment.settings cpu=None, memory=None, @@ -143,12 +144,13 @@ def app_create(cmd, client, resource_group, service, name, app_poller = client.apps.begin_create_or_update(resource_group, service, name, app_resource) wait_till_end(cmd, app_poller) - logger.warning('[2/3] Creating default deployment with name "{}"'.format(DEFAULT_DEPLOYMENT_NAME)) + banner_deployment_name = deployment_name or DEFAULT_DEPLOYMENT_NAME + logger.warning('[2/3] Creating default deployment with name "{}"'.format(banner_deployment_name)) deployment_resource = deployment_factory.format_resource(**create_deployment_kwargs, **basic_kwargs) poller = client.deployments.begin_create_or_update(resource_group, service, name, - DEFAULT_DEPLOYMENT_NAME, + banner_deployment_name, deployment_resource) logger.warning('[3/3] Updating app "{}" (this operation can take a while to complete)'.format(name)) app_resource = app_factory.format_resource(**update_app_kwargs, **basic_kwargs) diff --git a/src/spring/azext_spring/tests/latest/test_asa_app.py b/src/spring/azext_spring/tests/latest/test_asa_app.py index 3e951fe16cc..1ee522e2103 100644 --- a/src/spring/azext_spring/tests/latest/test_asa_app.py +++ b/src/spring/azext_spring/tests/latest/test_asa_app.py @@ -598,8 +598,8 @@ def _execute(self, *args, **kwargs): call_args = client.deployments.begin_create_or_update.call_args_list self.assertEqual(1, len(call_args)) self.assertEqual(5, len(call_args[0][0])) - self.assertEqual(args[0:3] + ('default',), call_args[0][0][0:4]) self.put_deployment_resource = call_args[0][0][4] + self.put_deployment_resource.name = call_args[0][0][3] call_args = client.apps.begin_update.call_args_list self.assertEqual(1, len(call_args)) @@ -693,6 +693,11 @@ def test_app_with_client_auth(self): resource = self.patch_app_resource self.assertIsNone(resource.properties.ingress_settings) + def test_app_create_with_deployment_name(self): + self._execute('rg', 'asc', 'app', cpu='1', memory='1Gi', instance_count=1, deployment_name='hello') + resource = self.put_deployment_resource + self.assertEqual('hello', resource.name) + class TestDeploymentCreate(BasicTest): def __init__(self, methodName: str = ...): super().__init__(methodName=methodName) diff --git a/src/spring/setup.py b/src/spring/setup.py index 5e610ff902b..cfb9695fc72 100644 --- a/src/spring/setup.py +++ b/src/spring/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.6.4' +VERSION = '1.6.5' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers