Skip to content

Commit

Permalink
Cleanup after renamed plugins (ansible-collections#1940)
Browse files Browse the repository at this point in the history
Cleanup after renamed plugins

SUMMARY
Prior to 5.0.0 we renamed various modules.  Cleanup the integration tests (and some docs).
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
plugins/modules/acm_certificate.py
plugins/modules/acm_certificate_info.py
plugins/modules/autoscaling_policy.py
plugins/modules/codepipeline.py
plugins/modules/storagegateway_info.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@c2fead0
  • Loading branch information
tremble authored and abikouo committed Oct 26, 2023
1 parent 502cb4a commit 45280a8
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 80 deletions.
12 changes: 6 additions & 6 deletions plugins/modules/acm_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@
EXAMPLES = r"""
- name: upload a self-signed certificate
community.aws.aws_acm:
community.aws.acm_certificate:
certificate: "{{ lookup('file', 'cert.pem' ) }}"
privateKey: "{{ lookup('file', 'key.pem' ) }}"
name_tag: my_cert # to be applied through an AWS tag as "Name":"my_cert"
region: ap-southeast-2 # AWS region
- name: create/update a certificate with a chain
community.aws.aws_acm:
community.aws.acm_certificate:
certificate: "{{ lookup('file', 'cert.pem' ) }}"
private_key: "{{ lookup('file', 'key.pem' ) }}"
name_tag: my_cert
Expand All @@ -188,25 +188,25 @@
var: cert_create.certificate.arn
- name: delete the cert we just created
community.aws.aws_acm:
community.aws.acm_certificate:
name_tag: my_cert
state: absent
region: ap-southeast-2
- name: delete a certificate with a particular ARN
community.aws.aws_acm:
community.aws.acm_certificate:
certificate_arn: "arn:aws:acm:ap-southeast-2:123456789012:certificate/01234567-abcd-abcd-abcd-012345678901"
state: absent
region: ap-southeast-2
- name: delete all certificates with a particular domain name
community.aws.aws_acm:
community.aws.acm_certificate:
domain_name: acm.ansible.com
state: absent
region: ap-southeast-2
- name: add tags to an existing certificate with a particular ARN
community.aws.aws_acm:
community.aws.acm_certificate:
certificate_arn: "arn:aws:acm:ap-southeast-2:123456789012:certificate/01234567-abcd-abcd-abcd-012345678901"
tags:
Name: my_certificate
Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/acm_certificate_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@

EXAMPLES = r"""
- name: obtain all ACM certificates
community.aws.aws_acm_info:
community.aws.acm_certificate_info:
- name: obtain all information for a single ACM certificate
community.aws.aws_acm_info:
community.aws.acm_certificate_info:
domain_name: "*.example_com"
- name: obtain all certificates pending validation
community.aws.aws_acm_info:
community.aws.acm_certificate_info:
statuses:
- PENDING_VALIDATION
- name: obtain all certificates with tag Name=foo and myTag=bar
community.aws.aws_acm_info:
community.aws.acm_certificate_info:
tags:
Name: foo
myTag: bar
# The output is still a list of certificates, just one item long.
- name: obtain information about a certificate with a particular ARN
community.aws.aws_acm_info:
community.aws.acm_certificate_info:
certificate_arn: "arn:aws:acm:ap-southeast-2:123456789012:certificate/abcdeabc-abcd-1234-4321-abcdeabcde12"
"""
Expand Down
70 changes: 35 additions & 35 deletions tests/integration/targets/acm_certificate/tasks/full_acm_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
session_token: '{{ security_token | default(omit) }}'
block:
- name: list certs
aws_acm_info: null
acm_certificate_info: null
register: list_all
- name: list certs with check mode
aws_acm_info: null
acm_certificate_info: null
register: list_all_check
check_mode: yes # read-only task, should work the same as with no
- name: check certificate listing worked
Expand All @@ -20,12 +20,12 @@
- list_all_check.certificates is defined
- list_all.certificates == list_all_check.certificates
- name: ensure absent cert which doesn't exist - first time
aws_acm:
acm_certificate:
name_tag: '{{ item.name }}'
state: absent
with_items: '{{ local_certs }}'
- name: ensure absent cert which doesn't exist - second time
aws_acm:
acm_certificate:
name_tag: '{{ item[0].name }}'
state: absent
check_mode: '{{ item[1] }}'
Expand All @@ -39,7 +39,7 @@
- not item.changed
with_items: "{{ absent_start_two.results }}"
- name: list cert which shouldn't exist
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ item.name }}'
register: list_tag
Expand Down Expand Up @@ -75,7 +75,7 @@
privatekey_path: '{{ item.priv_key }}'
selfsigned_digest: sha256
- name: upload certificate with check mode
aws_acm:
acm_certificate:
name_tag: '{{ item.name }}'
certificate: '{{ lookup(''file'', item.cert ) }}'
private_key: '{{ lookup(''file'', item.priv_key ) }}'
Expand All @@ -84,7 +84,7 @@
register: upload_check
with_items: '{{ local_certs }}'
- name: check whether cert was uploaded in check mode
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ item.name }}'
register: list_after_check_mode_upload
Expand All @@ -96,7 +96,7 @@
- upload_check.changed
- (item.certificates | length) == 0
- name: upload certificates first time
aws_acm:
acm_certificate:
name_tag: '{{ item.name }}'
certificate: '{{ lookup(''file'', item.cert ) }}'
private_key: '{{ lookup(''file'', item.priv_key ) }}'
Expand All @@ -119,7 +119,7 @@
original_cert: '{{ item.item }}'
prev_task: '{{ item }}'
- name: fetch data about cert just uploaded, by ARN
aws_acm_info:
acm_certificate_info:
certificate_arn: '{{ item.certificate.arn }}'
register: fetch_after_up
with_items: '{{ upload.results }}'
Expand All @@ -138,7 +138,7 @@
upload_result: '{{ item.item }}'
original_cert: '{{ item.item.item }}'
- name: fetch data about cert just uploaded, by name
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ original_cert.name }}'
register: fetch_after_up_name
Expand All @@ -161,7 +161,7 @@
upload_result: '{{ item.item }}'
original_cert: '{{ item.item.item }}'
- name: fetch data about cert just uploaded, by domain name
aws_acm_info:
acm_certificate_info:
domain_name: '{{ original_cert.domain }}'
register: fetch_after_up_domain
with_items: '{{ upload.results }}'
Expand All @@ -182,7 +182,7 @@
upload_result: '{{ item.item }}'
original_cert: '{{ item.item.item }}'
- name: upload certificates again, check not changed
aws_acm:
acm_certificate:
name_tag: '{{ item.name }}'
certificate: '{{ lookup(''file'', item.cert ) }}'
private_key: '{{ lookup(''file'', item.priv_key ) }}'
Expand All @@ -191,7 +191,7 @@
with_items: '{{ local_certs }}'
failed_when: upload2.changed
- name: update first cert with body of the second, first time, check mode
aws_acm:
acm_certificate:
state: present
name_tag: '{{ local_certs[0].name }}'
certificate: '{{ lookup(''file'', local_certs[1].cert ) }}'
Expand All @@ -203,7 +203,7 @@
that:
- overwrite_check.changed
- name: check previous tasks did not change real cert
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ local_certs[0].name }}'
register: fetch_after_overwrite_check
Expand All @@ -217,7 +217,7 @@
- '''Name'' in fetch_after_overwrite_check.certificates[0].tags'
- fetch_after_overwrite_check.certificates[0].tags['Name'] == local_certs[0].name
- name: update first cert with body of the second, first real time
aws_acm:
acm_certificate:
state: present
name_tag: '{{ local_certs[0].name }}'
certificate: '{{ lookup(''file'', local_certs[1].cert ) }}'
Expand All @@ -232,7 +232,7 @@
- overwrite.certificate.domain_name == local_certs[1].domain
- overwrite.changed
- name: check update was sucessfull
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ local_certs[0].name }}'
register: fetch_after_overwrite
Expand All @@ -246,7 +246,7 @@
- '''Name'' in fetch_after_overwrite.certificates[0].tags'
- fetch_after_overwrite.certificates[0].tags['Name'] == local_certs[0].name
- name: fetch other cert
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ local_certs[1].name }}'
register: check_after_overwrite
Expand All @@ -260,7 +260,7 @@
- '''Name'' in check_after_overwrite.certificates[0].tags'
- check_after_overwrite.certificates[0].tags['Name'] == local_certs[1].name
- name: update first cert with body of the second again
aws_acm:
acm_certificate:
state: present
name_tag: '{{ local_certs[0].name }}'
certificate: '{{ lookup(''file'', local_certs[1].cert ) }}'
Expand All @@ -275,7 +275,7 @@
- overwrite2.certificate.domain_name == local_certs[1].domain
- not overwrite2.changed
- name: delete certs 1 and 2 in check mode
aws_acm:
acm_certificate:
state: absent
domain_name: '{{ local_certs[1].domain }}'
check_mode: yes
Expand All @@ -285,7 +285,7 @@
that:
- delete_both_check.changed
- name: fetch info for certs 1 and 2
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ local_certs[item].name }}'
register: check_del_one_check
Expand All @@ -298,7 +298,7 @@
that:
- (item.certificates | length) == 1
- name: delete certs 1 and 2 real
aws_acm:
acm_certificate:
state: absent
domain_name: '{{ local_certs[1].domain }}'
register: delete_both
Expand All @@ -310,7 +310,7 @@
- upload.results[0].certificate.arn in delete_both.arns
- delete_both.changed
- name: fetch info for certs 1 and 2
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ local_certs[item].name }}'
register: check_del_one
Expand All @@ -327,7 +327,7 @@
assert:
that: (item.certificates | length) == 0
- name: check cert 3
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ local_certs[2].name }}'
register: check_del_one_remain
Expand All @@ -336,7 +336,7 @@
that:
- (check_del_one_remain.certificates | length) == 1
- name: delete cert 3
aws_acm:
acm_certificate:
state: absent
domain_name: '{{ local_certs[2].domain }}'
register: delete_third
Expand All @@ -348,13 +348,13 @@
- delete_third.arns[0] == upload.results[2].certificate.arn
- delete_third.changed
- name: check cert 3 was deleted
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ local_certs[2].name }}'
register: check_del_three
failed_when: check_del_three.certificates | length != 0
- name: delete cert 3 again
aws_acm:
acm_certificate:
state: absent
domain_name: '{{ local_certs[2].domain }}'
register: delete_third
Expand All @@ -365,7 +365,7 @@
- delete_third.arns | length == 0
- not delete_third.changed
- name: delete cert 3 again, check mode
aws_acm:
acm_certificate:
state: absent
domain_name: '{{ local_certs[2].domain }}'
check_mode: yes
Expand Down Expand Up @@ -415,7 +415,7 @@
root_certificates:
- '{{ local_certs[item.ca].cert }}'
- name: upload chained cert, first chain, first time
aws_acm:
acm_certificate:
name_tag: '{{ chained_cert.name }}'
certificate: '{{ lookup(''file'', chained_cert.chains[0].cert ) }}'
certificate_chain: '{{ chains.results[0].complete_chain | join(''
Expand All @@ -426,7 +426,7 @@
register: upload_chain
failed_when: not upload_chain.changed
- name: fetch chain of cert we just uploaded
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ chained_cert.name }}'
register: check_chain
Expand All @@ -440,7 +440,7 @@
- (check_chain.certificates[0].certificate_chain | replace( ' ', '' ) | replace( '\n', '')) == ( chains.results[0].complete_chain | join( '\n' ) | replace( ' ', '' ) | replace( '\n', '') )
- (check_chain.certificates[0].certificate | replace( ' ', '' ) | replace( '\n', '')) == ( lookup('file', chained_cert.chains[0].cert ) | replace( ' ', '' ) | replace( '\n', '') )
- name: upload chained cert again, check not changed
aws_acm:
acm_certificate:
name_tag: '{{ chained_cert.name }}'
certificate: '{{ lookup(''file'', chained_cert.chains[0].cert ) }}'
certificate_chain: '{{ chains.results[0].complete_chain | join(''
Expand All @@ -455,7 +455,7 @@
- upload_chain_2.certificate.arn == upload_chain.certificate.arn
- not upload_chain_2.changed
- name: upload chained cert, different chain
aws_acm:
acm_certificate:
name_tag: '{{ chained_cert.name }}'
certificate: '{{ lookup(''file'', chained_cert.chains[1].cert ) }}'
certificate_chain: '{{ chains.results[1].complete_chain | join(''
Expand All @@ -470,7 +470,7 @@
- upload_chain_3.changed
- upload_chain_3.certificate.arn == upload_chain.certificate.arn
- name: fetch info about chain of cert we just updated
aws_acm_info:
acm_certificate_info:
tags:
Name: '{{ chained_cert.name }}'
register: check_chain_2
Expand All @@ -480,7 +480,7 @@
- (check_chain_2.certificates[0].certificate_chain | replace( ' ', '' ) | replace( '\n', '')) == ( chains.results[1].complete_chain | join( '\n' ) | replace( ' ', '' ) | replace( '\n', '') )
- (check_chain_2.certificates[0].certificate | replace( ' ', '' ) | replace( '\n', '')) == ( lookup('file', chained_cert.chains[1].cert ) | replace( ' ', '' ) | replace( '\n', '') )
- name: delete chained cert
aws_acm:
acm_certificate:
name_tag: '{{ chained_cert.name }}'
state: absent
register: delete_chain_3
Expand All @@ -491,13 +491,13 @@
- upload_chain.certificate.arn in delete_chain_3.arns
always:
- name: delete first bunch of certificates
aws_acm:
acm_certificate:
name_tag: '{{ item.name }}'
state: absent
with_items: '{{ local_certs }}'
ignore_errors: true
- name: delete chained cert
aws_acm:
acm_certificate:
state: absent
name_tag: '{{ chained_cert.name }}'
ignore_errors: true
Expand Down
Loading

0 comments on commit 45280a8

Please sign in to comment.