-
Notifications
You must be signed in to change notification settings - Fork 398
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
Add force_absent parameter to ecs_ecr module #1316
Add force_absent parameter to ecs_ecr module #1316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vranyes,
Thanks for submitting this PR. I think this is a good addition to the module
A couple of things:
- The documentation you updated is actually auto-generated from the docs at the top of the module
- As well as the usual description/type definitions as a new parameter this will need
version_added: 4.1.0
Docs Build 📝Thank you for contribution!✨ The docsite for this PR is available for download as an artifact from this run: File changes:
Click to see the diff comparison.NOTE: only file modifications are shown here. New and deleted files are excluded. diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/ecs_ecr_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/ecs_ecr_module.html
index 8ef0b90..b2887b3 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/ecs_ecr_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/ecs_ecr_module.html
@@ -227,6 +227,19 @@ To check whether it is installed, run <code class="code docutils literal notrans
</div></td>
</tr>
<tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-force_absent"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-force-absent"><strong>force_absent</strong></p>
+<a class="ansibleOptionLink" href="#parameter-force_absent" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+<p><span class="ansible-option-versionadded">added in 4.1.0 of community.aws</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>If <em>force_absent=true</em>, the repository will be removed, even if images are present.</p>
+<p class="ansible-option-line"><span class="ansible-option-choices">Choices:</span></p>
+<ul class="simple">
+<li><p><span class="ansible-option-default-bold">no</span> <span class="ansible-option-default">← (default)</span></p></li>
+<li><p><span class="ansible-option-choices-entry">yes</span></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-force_set_policy"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-force-set-policy"><strong>force_set_policy</strong></p>
<a class="ansibleOptionLink" href="#parameter-force_set_policy" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
</div></td>
@@ -238,7 +251,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
</ul>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-image_tag_mutability"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-image-tag-mutability"><strong>image_tag_mutability</strong></p>
<a class="ansibleOptionLink" href="#parameter-image_tag_mutability" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
</div></td>
@@ -250,28 +263,28 @@ To check whether it is installed, run <code class="code docutils literal notrans
</ul>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-lifecycle_policy"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-lifecycle-policy"><strong>lifecycle_policy</strong></p>
<a class="ansibleOptionLink" href="#parameter-lifecycle_policy" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">json</span></p>
</div></td>
<td><div class="ansible-option-cell"><p>JSON or dict that represents the new lifecycle policy.</p>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-name"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-name"><strong>name</strong></p>
<a class="ansibleOptionLink" href="#parameter-name" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
</div></td>
<td><div class="ansible-option-cell"><p>The name of the repository.</p>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-policy"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-policy"><strong>policy</strong></p>
<a class="ansibleOptionLink" href="#parameter-policy" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">json</span></p>
</div></td>
<td><div class="ansible-option-cell"><p>JSON or dict that represents the new policy.</p>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-profile"></div>
<div class="ansibleOptionAnchor" id="parameter-aws_profile"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-profile"><span id="ansible-collections-community-aws-ecs-ecr-module-parameter-aws-profile"></span><strong>profile</strong></p>
<a class="ansibleOptionLink" href="#parameter-profile" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: aws_profile</span></p>
@@ -280,7 +293,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
<td><div class="ansible-option-cell"><p>The <em>profile</em> option is mutually exclusive with the <em>aws_access_key</em>, <em>aws_secret_key</em> and <em>security_token</em> options.</p>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-purge_lifecycle_policy"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-purge-lifecycle-policy"><strong>purge_lifecycle_policy</strong></p>
<a class="ansibleOptionLink" href="#parameter-purge_lifecycle_policy" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
</div></td>
@@ -293,7 +306,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
</ul>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-purge_policy"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-purge-policy"><strong>purge_policy</strong></p>
<a class="ansibleOptionLink" href="#parameter-purge_policy" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
</div></td>
@@ -306,7 +319,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
</ul>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-region"></div>
<div class="ansibleOptionAnchor" id="parameter-aws_region"></div>
<div class="ansibleOptionAnchor" id="parameter-ec2_region"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-region"><span id="ansible-collections-community-aws-ecs-ecr-module-parameter-ec2-region"></span><span id="ansible-collections-community-aws-ecs-ecr-module-parameter-aws-region"></span><strong>region</strong></p>
@@ -316,7 +329,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
<td><div class="ansible-option-cell"><p>The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See <a class="reference external" href="http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region">http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region</a></p>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-registry_id"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-registry-id"><strong>registry_id</strong></p>
<a class="ansibleOptionLink" href="#parameter-registry_id" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
</div></td>
@@ -324,7 +337,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
<p>If not specified, the default registry is assumed.</p>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-scan_on_push"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-scan-on-push"><strong>scan_on_push</strong></p>
<a class="ansibleOptionLink" href="#parameter-scan_on_push" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
<p><span class="ansible-option-versionadded">added in 1.3.0 of community.aws</span></p>
@@ -337,7 +350,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
</ul>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-security_token"></div>
<div class="ansibleOptionAnchor" id="parameter-aws_session_token"></div>
<div class="ansibleOptionAnchor" id="parameter-session_token"></div>
@@ -351,7 +364,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
<p>Aliases <em>aws_session_token</em> and <em>session_token</em> have been added in version 3.2.0.</p>
</div></td>
</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-state"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-state"><strong>state</strong></p>
<a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
</div></td>
@@ -363,7 +376,7 @@ To check whether it is installed, run <code class="code docutils literal notrans
</ul>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-validate_certs"></div><p class="ansible-option-title" id="ansible-collections-community-aws-ecs-ecr-module-parameter-validate-certs"><strong>validate_certs</strong></p>
<a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
</div></td>
|
Backport to stable-4: 💚 backport PR created✅ Backport PR branch: Backported as #1320 🤖 @patchback |
Add force_absent parameter to ecs_ecr module SUMMARY Adds a force_absent parameter to the ecs_ecr module. ISSUE TYPE Feature Pull Request COMPONENT NAME ecs_ecr module ADDITIONAL INFORMATION It would be useful for the ecs_ecr module to have capability for removing repositories which still contain images. This PR adds that ability by adding an additional parameter force_absent which has a default value of false and essentially just gets passed to the boto3 call for repo deletion. The following was run against a repository with an image in it. - name: Add ecr repos and sync with external sources. hosts: localhost connection: local gather_facts: false tasks: - name: test the changes register: state ecs_ecr: state: absent force_absent: true region: us-east-1 name: myimage/test - debug: var: state This was run with force_absent: true, force_absent: false and force_absent not defined. The expected behavior was seen in all three scenarios. I haven't added any new cases to the integration tests because there doesn't seem to be a great way to sync images into the repo that is created as part of the tests. Reviewed-by: Mark Chappell <None> Reviewed-by: Josiah Vranyes <None> (cherry picked from commit 5592372)
[PR #1316/55923724 backport][stable-4] Add force_absent parameter to ecs_ecr module This is a backport of PR #1316 as merged into main (5592372). SUMMARY Adds a force_absent parameter to the ecs_ecr module. ISSUE TYPE Feature Pull Request COMPONENT NAME ecs_ecr module ADDITIONAL INFORMATION It would be useful for the ecs_ecr module to have capability for removing repositories which still contain images. This PR adds that ability by adding an additional parameter force_absent which has a default value of false and essentially just gets passed to the boto3 call for repo deletion. The following was run against a repository with an image in it. - name: Add ecr repos and sync with external sources. hosts: localhost connection: local gather_facts: false tasks: - name: test the changes register: state ecs_ecr: state: absent force_absent: true region: us-east-1 name: myimage/test - debug: var: state This was run with force_absent: true, force_absent: false and force_absent not defined. The expected behavior was seen in all three scenarios. I haven't added any new cases to the integration tests because there doesn't seem to be a great way to sync images into the repo that is created as part of the tests. Reviewed-by: Mark Chappell <None>
SUMMARY
Adds a
force_absent
parameter to theecs_ecr
module.ISSUE TYPE
COMPONENT NAME
ecs_ecr
moduleADDITIONAL INFORMATION
It would be useful for the
ecs_ecr
module to have capability for removing repositories which still contain images.This PR adds that ability by adding an additional parameter
force_absent
which has a default value offalse
and essentially just gets passed to the boto3 call for repo deletion.The following was run against a repository with an image in it.
This was run with
force_absent: true
,force_absent: false
andforce_absent
not defined.The expected behavior was seen in all three scenarios.
I haven't added any new cases to the integration tests because there doesn't seem to be a great way to sync images into the repo that is created as part of the tests.