mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
add module aws_codecommit to represent AWS CodeCommit (#46161)
* kick off * done for the day * beta code and test * fix a typo * boto3_conn and boto_exception aren't used in this code, ec2_argument_spec is used but unneeded. * Returning when find a match avoids doing extra work, especially when pagination is involved * add new permissions for test * (output is changed) is preferred over accessing the attribute directly. * pass the result through camel_dict_to_snake_dict() before returning it. * AnsibleAWSModule automatically merges the argument_spec. * deletes the created resources even if a test fails. * AnsibleAWSModule automatically merges the argument_spec. * fix typo * fix pep8 * paginate list_repositories * specify permissions for test * cut the unnecessary code. * add return doc string * add missed ':' * fix syntax error: mapping values are not allowed here * add description for return * fix syntax error * rename module name and turn off automated integration test.
This commit is contained in:
2
test/integration/targets/aws_codecommit/aliases
Normal file
2
test/integration/targets/aws_codecommit/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/aws
|
||||
unsupported
|
||||
67
test/integration/targets/aws_codecommit/tasks/main.yml
Normal file
67
test/integration/targets/aws_codecommit/tasks/main.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
- block:
|
||||
# ============================================================
|
||||
- name: set connection information for all tasks
|
||||
set_fact:
|
||||
aws_connection_info: &aws_connection_info
|
||||
aws_access_key: "{{ aws_access_key }}"
|
||||
aws_secret_key: "{{ aws_secret_key }}"
|
||||
security_token: "{{ security_token }}"
|
||||
region: "{{ aws_region }}"
|
||||
no_log: true
|
||||
# ============================================================
|
||||
- name: Create a repository
|
||||
aws_codecommit:
|
||||
name: "{{ resource_prefix }}_repo"
|
||||
comment: original comment
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: output
|
||||
- assert:
|
||||
that:
|
||||
- output is changed
|
||||
- output.repositoryName == '{{ resource_prefix }}_repo'
|
||||
- output.repositoryDescription == 'original comment'
|
||||
# ============================================================
|
||||
- name: Create a repository (CHECK MODE)
|
||||
aws_codecommit:
|
||||
name: "{{ resource_prefix }}_check_repo"
|
||||
comment: original comment
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: output
|
||||
check_mode: yes
|
||||
- assert:
|
||||
that:
|
||||
- output is changed
|
||||
- output.repositoryName == '{{ resource_prefix }}_check_repo'
|
||||
- output.repositoryDescription == 'original comment'
|
||||
# ============================================================
|
||||
- name: Delete a repository (CHECK MODE)
|
||||
aws_codecommit:
|
||||
name: "{{ resource_prefix }}_repo"
|
||||
state: absent
|
||||
<<: *aws_connection_info
|
||||
register: output
|
||||
check_mode: yes
|
||||
- assert:
|
||||
that:
|
||||
- output is changed
|
||||
- name: Delete a repository
|
||||
aws_codecommit:
|
||||
name: "{{ resource_prefix }}_repo"
|
||||
state: absent
|
||||
<<: *aws_connection_info
|
||||
register: output
|
||||
- assert:
|
||||
that:
|
||||
- output is changed
|
||||
|
||||
always:
|
||||
###### TEARDOWN STARTS HERE ######
|
||||
- name: Delete a repository
|
||||
aws_codecommit:
|
||||
name: "{{ resource_prefix }}_repo"
|
||||
state: absent
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
||||
Reference in New Issue
Block a user