add new module for webapp slot (#48862)

* add new module for webapp slot

* fix lint and resolve comments

* fix lint

* fix lint

* fix lint

* fix name in test

* add variable

* fix test parameter

* fix test frameworks

* fix test

* remove delete due to swap not finish

* resolve comments

* fix lint

* fix typo
This commit is contained in:
Yunge Zhu 2019-01-31 07:20:32 +08:00 committed by Matt Davis
parent 55436fde26
commit dd2032a3ad
3 changed files with 1134 additions and 1 deletions

File diff suppressed because it is too large Load diff

View file

@ -2,3 +2,4 @@ cloud/azure
shippable/azure/group4 shippable/azure/group4
destructive destructive
azure_rm_webapp_facts azure_rm_webapp_facts
azure_rm_webappslot

View file

@ -4,6 +4,7 @@
win_app_name: "{{ (resource_prefix | replace('-','x'))[-8:] }}{{ 1000 | random}}winapp" win_app_name: "{{ (resource_prefix | replace('-','x'))[-8:] }}{{ 1000 | random}}winapp"
win_plan_name: "{{ (resource_prefix | replace('-','x'))[-8:] }}winplan" win_plan_name: "{{ (resource_prefix | replace('-','x'))[-8:] }}winplan"
linux_plan_name: "{{ (resource_group_secondary | replace('-','x'))[-8:] }}linplan" linux_plan_name: "{{ (resource_group_secondary | replace('-','x'))[-8:] }}linplan"
slot1_name: "stage1"
- name: Create a windows web app with non-exist app service plan - name: Create a windows web app with non-exist app service plan
azure_rm_webapp: azure_rm_webapp:
@ -341,4 +342,93 @@
- name: Assert publish profile returned - name: Assert publish profile returned
assert: assert:
that: that:
- facts.webapps[0].ftp_publish_url != '' - facts.webapps[0].ftp_publish_url != ''
- name: Create a webapp slot (Check mode)
azure_rm_webappslot:
resource_group: "{{ resource_group }}"
webapp_name: "{{ win_app_name }}13"
name: "{{ slot1_name }}"
configuration_source: "{{ win_app_name }}13"
app_settings:
testkey: testvalue
check_mode: yes
register: output
- name: Assert slot check mode creation
assert:
that:
- output.changed
- name: Create a webapp slot
azure_rm_webappslot:
resource_group: "{{ resource_group }}"
webapp_name: "{{ win_app_name }}13"
name: "{{ slot1_name }}"
configuration_source: "{{ win_app_name }}13"
app_settings:
testkey: testvalue
register: output
- name: Assert slot creation
assert:
that:
- output.changed
- name: Update webapp slot (idempotence)
azure_rm_webappslot:
resource_group: "{{ resource_group }}"
webapp_name: "{{ win_app_name }}13"
name: "{{ slot1_name }}"
app_settings:
testkey: testvalue
register: output
- name: Assert idempotence
assert:
that:
- not output.changed
- name: Update webapp slot
azure_rm_webappslot:
resource_group: "{{ resource_group }}"
webapp_name: "{{ win_app_name }}13"
name: "{{ slot1_name }}"
frameworks:
- name: "node"
version: "10.1"
app_settings:
testkey: testvalue2
register: output
- name: Assert updating
assert:
that:
- output.changed
- name: Swap webapp slot
azure_rm_webappslot:
resource_group: "{{ resource_group }}"
webapp_name: "{{ win_app_name }}13"
name: "{{ slot1_name }}"
swap:
action: swap
register: output
- name: Assert swap
assert:
that:
- output.changed
- name: Stop webapp slot
azure_rm_webappslot:
resource_group: "{{ resource_group }}"
webapp_name: "{{ win_app_name }}13"
name: "{{ slot1_name }}"
app_state: stopped
register: output
- name: Assert stopped
assert:
that:
- output.changed