mirror of https://github.com/ansible/ansible.git
aws_codecommit: Fix integration tests and Add support for updating the description (#61263)
* Update DevOps AWS policy - Fix typos in permission names - While AWS claims you can use 'arn:aws:codecommit:*' it errors unless you use '*' * aws_codecommit: (integration tests) Migrate to module_defaults * aws_codecommit: (integration tests) Fix integration tests * aws_codecommit: (integration tests) Add tests for updating the description * aws_codecommit: Add support for updating the description and rename "comment" option to "description"pull/61622/head
parent
0e1ec04efb
commit
35359959de
@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- aws_codecommit - Support updating the description
|
||||||
@ -1,65 +1,105 @@
|
|||||||
---
|
---
|
||||||
- block:
|
- module_defaults:
|
||||||
# ============================================================
|
group/aws:
|
||||||
- name: set connection information for all tasks
|
|
||||||
set_fact:
|
|
||||||
aws_connection_info: &aws_connection_info
|
|
||||||
aws_access_key: "{{ aws_access_key }}"
|
aws_access_key: "{{ aws_access_key }}"
|
||||||
aws_secret_key: "{{ aws_secret_key }}"
|
aws_secret_key: "{{ aws_secret_key }}"
|
||||||
security_token: "{{ security_token }}"
|
security_token: "{{ security_token | default(omit) }}"
|
||||||
region: "{{ aws_region }}"
|
region: "{{ aws_region }}"
|
||||||
no_log: true
|
block:
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
- name: Create a repository (CHECK MODE)
|
||||||
|
aws_codecommit:
|
||||||
|
name: "{{ resource_prefix }}_repo"
|
||||||
|
description: original comment
|
||||||
|
state: present
|
||||||
|
register: output
|
||||||
|
check_mode: yes
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- output is changed
|
||||||
|
|
||||||
- name: Create a repository
|
- name: Create a repository
|
||||||
aws_codecommit:
|
aws_codecommit:
|
||||||
name: "{{ resource_prefix }}_repo"
|
name: "{{ resource_prefix }}_repo"
|
||||||
comment: original comment
|
description: original comment
|
||||||
state: present
|
state: present
|
||||||
<<: *aws_connection_info
|
|
||||||
register: output
|
register: output
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- output is changed
|
- output is changed
|
||||||
- output['repository_metadata'].repository_name == '{{ resource_prefix }}_repo'
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
||||||
- output['repository_metadata'].repository_description == 'original comment'
|
- output.repository_metadata.repository_description == 'original comment'
|
||||||
# ============================================================
|
|
||||||
- name: Create a repository (CHECK MODE)
|
- name: No-op update to repository
|
||||||
aws_codecommit:
|
aws_codecommit:
|
||||||
name: "{{ resource_prefix }}_check_repo"
|
name: "{{ resource_prefix }}_repo"
|
||||||
comment: original comment
|
description: original comment
|
||||||
|
state: present
|
||||||
|
register: output
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- output is not changed
|
||||||
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
||||||
|
- output.repository_metadata.repository_description == 'original comment'
|
||||||
|
|
||||||
|
- name: Update repository description (CHECK MODE)
|
||||||
|
aws_codecommit:
|
||||||
|
name: "{{ resource_prefix }}_repo"
|
||||||
|
description: new comment
|
||||||
state: present
|
state: present
|
||||||
<<: *aws_connection_info
|
|
||||||
register: output
|
register: output
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- output is changed
|
- output is changed
|
||||||
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
||||||
|
- output.repository_metadata.repository_description == 'original comment'
|
||||||
|
|
||||||
|
- name: Update repository description
|
||||||
|
aws_codecommit:
|
||||||
|
name: "{{ resource_prefix }}_repo"
|
||||||
|
description: new comment
|
||||||
|
state: present
|
||||||
|
register: output
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- output is changed
|
||||||
|
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo'
|
||||||
|
- output.repository_metadata.repository_description == 'new comment'
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
- name: Delete a repository (CHECK MODE)
|
- name: Delete a repository (CHECK MODE)
|
||||||
aws_codecommit:
|
aws_codecommit:
|
||||||
name: "{{ resource_prefix }}_repo"
|
name: "{{ resource_prefix }}_repo"
|
||||||
state: absent
|
state: absent
|
||||||
<<: *aws_connection_info
|
|
||||||
register: output
|
register: output
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- output is changed
|
- output is changed
|
||||||
|
|
||||||
- name: Delete a repository
|
- name: Delete a repository
|
||||||
aws_codecommit:
|
aws_codecommit:
|
||||||
name: "{{ resource_prefix }}_repo"
|
name: "{{ resource_prefix }}_repo"
|
||||||
state: absent
|
state: absent
|
||||||
<<: *aws_connection_info
|
|
||||||
register: output
|
register: output
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- output is changed
|
- output is changed
|
||||||
|
|
||||||
|
- name: Delete a non-existent repository
|
||||||
|
aws_codecommit:
|
||||||
|
name: "{{ resource_prefix }}_repo"
|
||||||
|
state: absent
|
||||||
|
register: output
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- output is not changed
|
||||||
|
|
||||||
always:
|
always:
|
||||||
###### TEARDOWN STARTS HERE ######
|
###### TEARDOWN STARTS HERE ######
|
||||||
- name: Delete a repository
|
- name: Delete a repository
|
||||||
aws_codecommit:
|
aws_codecommit:
|
||||||
name: "{{ resource_prefix }}_repo"
|
name: "{{ resource_prefix }}_repo"
|
||||||
state: absent
|
state: absent
|
||||||
<<: *aws_connection_info
|
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|||||||
Loading…
Reference in New Issue