Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to create Web App with Java11/Java17/Java21 #1495

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions plugins/modules/azure_rm_webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/targets/azure_rm_webapp/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -242,7 +242,7 @@
name: "{{ linux_plan_name }}"
frameworks:
- name: node
version: "6.6"
version: "18"
register: output

- name: Assert idempotent
Expand All @@ -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
Expand Down Expand Up @@ -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."'

Expand All @@ -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."

Expand Down