diff --git a/src/azure-cli/azure/cli/command_modules/appservice/_help.py b/src/azure-cli/azure/cli/command_modules/appservice/_help.py index cd5519fff1d..c66b5834aa8 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/_help.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/_help.py @@ -53,7 +53,7 @@ - name: Create a Windows container app service plan. text: > az appservice plan create -g MyResourceGroup -n MyPlan \\ - --hyper-v --sku P3V3 + --hyper-v --sku P1V3 - name: Create an app service plan for app service environment. text: > az appservice plan create -g MyResourceGroup -n MyPlan \\ @@ -1434,6 +1434,12 @@ - name: Create a web app with the default configuration. text: > az webapp create -g MyResourceGroup -p MyPlan -n MyUniqueAppName + - name: Create a web app with a java|11|Java SE|8 runtime using '|' delimiter. + text: > + az webapp create -g MyResourceGroup -p MyPlan -n MyUniqueAppName --runtime "java|11|Java SE|8" + - name: Create a web app with a java|11|Java SE|8 runtime using ':' delimiter. + text: > + az webapp create -g MyResourceGroup -p MyPlan -n MyUniqueAppName --runtime "java:11:Java SE:8" - name: Create a web app with a NodeJS 10.14 runtime and deployed from a local git repository. text: > az webapp create -g MyResourceGroup -p MyPlan -n MyUniqueAppName --runtime "node|10.14" --deployment-local-git @@ -1958,6 +1964,12 @@ - name: Create a web app with a specified name text: > az webapp up -n MyUniqueAppName + - name: Create a web app with a specified name and a java|11|Java SE|8 runtime using '|' delimiter + text: > + az webapp up -n MyUniqueAppName --runtime "java|11|Java SE|8" + - name: Create a web app with a specified name and a java|11|Java SE|8 runtime using ':' delimiter + text: > + az webapp up -n MyUniqueAppName --runtime "java:11:Java SE:8" - name: Create a web app in a specific region, by running the command from the folder where the code to be deployed exists. text: > az webapp up -l locationName diff --git a/src/azure-cli/azure/cli/command_modules/appservice/_params.py b/src/azure-cli/azure/cli/command_modules/appservice/_params.py index b2279200c68..a69f84ee9c5 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/_params.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/_params.py @@ -131,7 +131,7 @@ def load_arguments(self, _): c.argument('docker_registry_server_password', options_list=['--docker-registry-server-password', '-w'], help='The container registry server password. Required for private registries.') c.argument('multicontainer_config_type', options_list=['--multicontainer-config-type'], help="Linux only.", arg_type=get_enum_type(MULTI_CONTAINER_TYPES)) c.argument('multicontainer_config_file', options_list=['--multicontainer-config-file'], help="Linux only. Config file for multicontainer apps. (local or remote)") - c.argument('runtime', options_list=['--runtime', '-r'], help="canonicalized web runtime in the format of Framework|Version, e.g. \"PHP|7.2\". Allowed delimiters: \"|\", \" \", \":\". " + c.argument('runtime', options_list=['--runtime', '-r'], help="canonicalized web runtime in the format of Framework|Version, e.g. \"PHP|7.2\". Allowed delimiters: \"|\" or \":\". " "Use `az webapp list-runtimes` for available list") # TODO ADD completer c.argument('plan', options_list=['--plan', '-p'], configured_default='appserviceplan', completer=get_resource_name_completion_list('Microsoft.Web/serverFarms'), @@ -609,7 +609,7 @@ def load_arguments(self, _): local_context_attribute=LocalContextAttribute(name='plan_name', actions=[LocalContextAction.GET])) c.argument('sku', arg_type=sku_arg_type) c.argument('os_type', options_list=['--os-type'], arg_type=get_enum_type(OS_TYPES), help="Set the OS type for the app to be created.") - c.argument('runtime', options_list=['--runtime', '-r'], help="canonicalized web runtime in the format of Framework|Version, e.g. \"PHP|7.2\". Allowed delimiters: \"|\", \" \", \":\". " + c.argument('runtime', options_list=['--runtime', '-r'], help="canonicalized web runtime in the format of Framework|Version, e.g. \"PHP|7.2\". Allowed delimiters: \"|\" or \":\". " "Use `az webapp list-runtimes` for available list.") c.argument('dryrun', help="show summary of the create and deploy operation instead of executing it", default=False, action='store_true') diff --git a/src/azure-cli/azure/cli/command_modules/appservice/custom.py b/src/azure-cli/azure/cli/command_modules/appservice/custom.py index c2b42e5801a..b8f556141a6 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/custom.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/custom.py @@ -2619,7 +2619,13 @@ def __init__(self, cmd, client, linux=False): @staticmethod def remove_delimiters(runtime): import re - runtime = re.split('[| :]', runtime) # delimiters allowed: '|', ' ', ':' + # delimiters allowed: '|', ':' + if '|' in runtime: + runtime = re.split('[|]', runtime) + elif ':' in runtime: + runtime = re.split('[:]', runtime) + else: + runtime = [runtime] return '|'.join(filter(None, runtime)) def resolve(self, display_name): diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_up_runtime_delimiters.yaml b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_up_runtime_delimiters.yaml index 4ab83e4e8f9..a983056f353 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_up_runtime_delimiters.yaml +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_up_runtime_delimiters.yaml @@ -18,7 +18,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: POST @@ -34,7 +34,7 @@ interactions: content-type: - application/json date: - - Mon, 14 Dec 2020 20:59:08 GMT + - Thu, 14 Jan 2021 03:44:23 GMT expires: - '-1' pragma: @@ -71,7 +71,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: GET @@ -186,7 +186,7 @@ interactions: content-type: - application/json date: - - Mon, 14 Dec 2020 20:59:09 GMT + - Thu, 14 Jan 2021 03:44:23 GMT expires: - '-1' pragma: @@ -223,11 +223,11 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-resource/12.0.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: HEAD - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-10-01 response: body: string: '' @@ -237,7 +237,7 @@ interactions: content-length: - '0' date: - - Mon, 14 Dec 2020 20:59:09 GMT + - Thu, 14 Jan 2021 03:44:23 GMT expires: - '-1' pragma: @@ -264,7 +264,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: GET @@ -280,7 +280,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 14 Dec 2020 20:59:09 GMT + - Thu, 14 Jan 2021 03:44:23 GMT expires: - '-1' pragma: @@ -309,11 +309,11 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-resource/12.0.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: HEAD - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-10-01 response: body: string: '' @@ -323,7 +323,7 @@ interactions: content-length: - '0' date: - - Mon, 14 Dec 2020 20:59:10 GMT + - Thu, 14 Jan 2021 03:44:24 GMT expires: - '-1' pragma: @@ -350,7 +350,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: GET @@ -366,7 +366,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 14 Dec 2020 20:59:11 GMT + - Thu, 14 Jan 2021 03:44:24 GMT expires: - '-1' pragma: @@ -399,7 +399,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: POST @@ -415,7 +415,7 @@ interactions: content-type: - application/json date: - - Mon, 14 Dec 2020 20:59:11 GMT + - Thu, 14 Jan 2021 03:44:25 GMT expires: - '-1' pragma: @@ -452,7 +452,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: GET @@ -567,7 +567,7 @@ interactions: content-type: - application/json date: - - Mon, 14 Dec 2020 20:59:11 GMT + - Thu, 14 Jan 2021 03:44:25 GMT expires: - '-1' pragma: @@ -604,11 +604,11 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-resource/12.0.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: HEAD - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-10-01 response: body: string: '' @@ -618,7 +618,7 @@ interactions: content-length: - '0' date: - - Mon, 14 Dec 2020 20:59:12 GMT + - Thu, 14 Jan 2021 03:44:25 GMT expires: - '-1' pragma: @@ -645,7 +645,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: GET @@ -661,7 +661,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 14 Dec 2020 20:59:13 GMT + - Thu, 14 Jan 2021 03:44:26 GMT expires: - '-1' pragma: @@ -690,11 +690,11 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-resource/12.0.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: HEAD - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-10-01 response: body: string: '' @@ -704,7 +704,7 @@ interactions: content-length: - '0' date: - - Mon, 14 Dec 2020 20:59:13 GMT + - Thu, 14 Jan 2021 03:44:26 GMT expires: - '-1' pragma: @@ -731,7 +731,7 @@ interactions: - -n -g --plan --os --runtime --sku --dryrun User-Agent: - python/3.6.7 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3 - azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.16.0 + azure-mgmt-web/0.48.0 Azure-SDK-For-Python AZURECLI/2.17.1 accept-language: - en-US method: GET @@ -747,7 +747,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 14 Dec 2020 20:59:14 GMT + - Thu, 14 Jan 2021 03:44:26 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_up_commands.py b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_up_commands.py index 4560b7a5e30..d5025cde26a 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_up_commands.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_up_commands.py @@ -627,23 +627,21 @@ def test_webapp_up_runtime_delimiters(self, resource_group): # test dryrun operation result = self.cmd( - 'webapp up -n {} -g {} --plan {} --os "linux" --runtime "node 10.6" --sku "S1" --dryrun'.format(webapp_name, resource_group, plan)).get_output_in_json() + 'webapp up -n {} -g {} --plan {} --os "windows" --runtime "java|1.8|Java SE|8" --sku "S1" --dryrun'.format(webapp_name, resource_group, plan)).get_output_in_json() self.assertTrue(result['sku'].lower() == 'standard') self.assertTrue(result['name'].startswith(webapp_name)) self.assertTrue(result['src_path'].replace( os.sep + os.sep, os.sep), up_working_dir) - self.assertTrue(result['runtime_version'] == 'node|10.6') - self.assertTrue(result['os'].lower() == 'linux') + self.assertTrue(result['runtime_version'] == 'java|1.8|Java SE|8') # test dryrun operation result = self.cmd( - 'webapp up -n {} -g {} --plan {} --os "linux" --runtime "node:10.1" --sku "S1" --dryrun'.format(webapp_name, resource_group, plan)).get_output_in_json() + 'webapp up -n {} -g {} --plan {} --os "windows" --runtime "java:1.8:Java SE:8" --sku "S1" --dryrun'.format(webapp_name, resource_group, plan)).get_output_in_json() self.assertTrue(result['sku'].lower() == 'standard') self.assertTrue(result['name'].startswith(webapp_name)) self.assertTrue(result['src_path'].replace( os.sep + os.sep, os.sep), up_working_dir) - self.assertTrue(result['runtime_version'] == 'node|10.1') - self.assertTrue(result['os'].lower() == 'linux') + self.assertTrue(result['runtime_version'] == 'java|1.8|Java SE|8') # cleanup # switch back the working dir