From 2e99c9b18186265cffdf4a9114bbb4ce0b18e515 Mon Sep 17 00:00:00 2001 From: Fred-sun <37327967+Fred-sun@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:02:38 +0800 Subject: [PATCH] Support to create Web App with Java11/Java17/Java21 (#1495) --- plugins/modules/azure_rm_webapp.py | 30 +++++++++---------- .../targets/azure_rm_webapp/tasks/main.yml | 18 +++++------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/plugins/modules/azure_rm_webapp.py b/plugins/modules/azure_rm_webapp.py index ed534c765..e58cbcd43 100644 --- a/plugins/modules/azure_rm_webapp.py +++ b/plugins/modules/azure_rm_webapp.py @@ -76,13 +76,13 @@ version: description: - Version of the framework. For Linux web app supported value, see U(https://aka.ms/linux-stacks) for more info. - - C(net_framework) supported value sample, C(v4.0) for .NET 4.6 and C(v3.0) for .NET 3.5. - - C(php) supported value sample, C(5.5), C(5.6), C(7.0). - - C(python) supported value sample, C(2.7), C(3.8), C(3.10). - - C(node) supported value sample, C(6.6), C(6.9). - - C(dotnetcore) supported value sample, C(1.0), C(1.1), C(1.2). + - C(net_framework) supported value sample, C(v4.8) for .NET 4.8 and C(v3.5) for .NET 3.5. + - C(php) supported value sample, C(8.1), C(8.2). + - C(python) supported value sample, C(3.8), C(3.9), C(3.10), C(3.11), C(3.12). + - C(node) supported value sample, C(18), C(20). + - C(dotnetcore) supported value sample, C(8), C(7), C(6). - C(ruby) supported value sample, C(2.3). - - C(java) supported value sample, C(1.9) for Windows web app. C(1.8) for Linux web app. + - C(java) supported value sample, C(21), C(17), C(11) and C(8). type: str required: true settings: @@ -93,14 +93,14 @@ java_container: description: - Name of Java container. - - Supported only when I(frameworks=java). Sample values C(Tomcat), C(Jetty). + - Supported only when I(frameworks=java). Sample values C(Tomcat), C(JavaSE), C(RedHat). type: str required: True java_container_version: description: - Version of Java container. - Supported only when I(frameworks=java). - - Sample values for C(Tomcat), C(8.0), C(8.5), C(9.0). For C(Jetty,), C(9.1), C(9.3). + - Sample values for C(Tomcat), C(8.5), C(9.0), C(10.0), C(10.1). type: str required: True @@ -294,7 +294,7 @@ testkey: testvalue frameworks: - name: "node" - version: "6.6" + version: "18" - name: Create a windows web app with node, php azure_rm_webapp: @@ -307,9 +307,9 @@ testkey: testvalue frameworks: - name: "node" - version: 6.6 + version: 18 - name: "php" - version: "7.0" + version: 8.2 - name: Create a stage deployment slot for an existing web app azure_rm_webapp: @@ -600,7 +600,7 @@ def __init__(self): "https_only"] self.supported_linux_frameworks = ['ruby', 'php', 'python', 'dotnetcore', 'node', 'java'] - self.supported_windows_frameworks = ['net_framework', 'php', 'python', 'node', 'java'] + self.supported_windows_frameworks = ['net_framework', 'php', 'python', 'node', 'java', 'dotnetcore'] super(AzureRMWebApps, self).__init__(derived_arg_spec=self.module_arg_spec, mutually_exclusive=mutually_exclusive, @@ -664,15 +664,15 @@ def exec_module(self, **kwargs): self.site_config['linux_fx_version'] = (self.frameworks[0]['name'] + '|' + self.frameworks[0]['version']).upper() if self.frameworks[0]['name'] == 'java': - if self.frameworks[0]['version'] != '8': - self.fail("Linux web app only supports java 8.") + if self.frameworks[0]['version'] not in ['8', '11', '17', '21']: + self.fail("Linux web app only supports java 8, 11, 17 and 21.") if self.frameworks[0]['settings'] and self.frameworks[0]['settings']['java_container'].lower() != 'tomcat': self.fail("Linux web app only supports tomcat container.") if self.frameworks[0]['settings'] and self.frameworks[0]['settings']['java_container'].lower() == 'tomcat': self.site_config['linux_fx_version'] = 'TOMCAT|' + self.frameworks[0]['settings']['java_container_version'] + '-jre8' else: - self.site_config['linux_fx_version'] = 'JAVA|8-jre8' + self.site_config['linux_fx_version'] = 'JAVA|{0}-jre{0}'.format(self.frameworks[0]['version']) else: for fx in self.frameworks: if fx.get('name') not in self.supported_windows_frameworks: diff --git a/tests/integration/targets/azure_rm_webapp/tasks/main.yml b/tests/integration/targets/azure_rm_webapp/tasks/main.yml index 8f290a6fa..6b8128eb3 100644 --- a/tests/integration/targets/azure_rm_webapp/tasks/main.yml +++ b/tests/integration/targets/azure_rm_webapp/tasks/main.yml @@ -83,7 +83,7 @@ plan: "{{ win_plan_name }}" frameworks: - name: "java" - version: "1.8" + version: "17" settings: java_container: "Tomcat" java_container_version: "8.0" @@ -115,7 +115,7 @@ plan: "{{ win_plan_name }}" frameworks: - name: "java" - version: "1.7" + version: "17" settings: java_container: "Tomcat" java_container_version: "8.5" @@ -230,7 +230,7 @@ name: "{{ linux_plan_name }}" frameworks: - name: node - version: "6.6" + version: "18" register: output - name: Should be idempotent with linux web app created @@ -242,7 +242,7 @@ name: "{{ linux_plan_name }}" frameworks: - name: node - version: "6.6" + version: "18" register: output - name: Assert idempotent @@ -258,7 +258,7 @@ name: "{{ linux_plan_name }}" frameworks: - name: node - version: "6.9" + version: "20" register: output - name: Assert the web app was created @@ -300,9 +300,9 @@ plan: "{{ win_plan_name }}" frameworks: - name: "python" - version: "2.7" + version: "3.11" - name: "java" - version: "1.8" + version: "17" register: fail_win_java_version_mutual_exclusive failed_when: 'fail_win_java_version_mutual_exclusive.msg != "Java is mutually exclusive with other frameworks."' @@ -315,9 +315,9 @@ name: "{{ linux_plan_name }}" frameworks: - name: "python" - version: "2.7" + version: "3.11" - name: "node" - version: "6.6" + version: "18" register: fail_linux_one_framework_only failed_when: fail_linux_one_framework_only.msg != "Can specify one framework only for Linux web app."