Skip to content
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

Fixes #5313: redhat_subscription module is not idempotent when pool_ids are used #5314

Conversation

cfiehe
Copy link
Contributor

@cfiehe cfiehe commented Sep 26, 2022

This fix ensures the idempotency of the redhat_subscription module when pool_ids are used. The main problem was, that a 'None' quantity was not properly handled and that the quantity check compared a string with an integer.

Signed-off-by: Christoph Fiehe [email protected]

SUMMARY
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

redhat_subscription

ADDITIONAL INFORMATION

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor os packaging plugins plugin (any type) labels Sep 26, 2022
@cfiehe cfiehe changed the title Fixes #5313. Fixes #5313: redhat_subscription module is not idempotent when pool_ids are used Sep 26, 2022
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Sep 26, 2022
@cfiehe cfiehe force-pushed the rhsm_fix_idempotency_with_pool_ids branch from 4426a0e to 2acb64a Compare September 26, 2022 13:28
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-4 labels Sep 26, 2022
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Can you please add a changelog fragment? Thanks.

…otent when pool_ids

This fix ensures the idempotency of the redhat_subscription module when pool_ids are used. The main problem was, that a 'None' quantity was not properly handled and that the quantity check compared a string with an integer.

Signed-off-by: Christoph Fiehe <[email protected]>
@cfiehe cfiehe force-pushed the rhsm_fix_idempotency_with_pool_ids branch from 66e8710 to a7ad6e5 Compare September 26, 2022 18:45
@cfiehe
Copy link
Contributor Author

cfiehe commented Sep 26, 2022

I have added the missing changelog fragment. Sorry!

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot judge the code change itself, I hope that one of the maintainers can take a look at it.

@@ -0,0 +1,2 @@
bugfixes:
- redhat_subscription - fix redhat_subscription module is not idempotent when pool_ids are used (https://github.com/ansible-collections/community.general/issues/5313).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- redhat_subscription - fix redhat_subscription module is not idempotent when pool_ids are used (https://github.com/ansible-collections/community.general/issues/5313).
- redhat_subscription - make module idempotent when ``pool_ids`` are used (https://github.com/ansible-collections/community.general/issues/5313).

nxet and others added 2 commits September 29, 2022 08:00
…nsible-collections#5274)

* module_utils.proxmox: new `api_task_ok` helper + integrated with existing modules

* proxmox_snap: add `unbind` param to snapshot containers with mountpoints

* [fix] errors reported by 'test sanity pep8'
at 
ansible-collections#5274 (comment)

* module_utils.proxmox.api_task_ok: small improvement

* proxmox_snap.unbind: version_added, formatting errors, changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <[email protected]>

* proxmox_snap.unbind: update version_added tag

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Felix Fontein <[email protected]>
…ollections#5291)

* fix ansible-collections#5290

* add changelog fragment

* remove unnecessary braces

* Update changelogs/fragments/5291-fix-nmcli-error-when-setting-unset-mac-address.yaml

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Felix Fontein <[email protected]>
@ansibullbot
Copy link
Collaborator

@ansibullbot
Copy link
Collaborator

@cfiehe this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibullbot ansibullbot added the merge_commit This PR contains at least one merge commit. Please resolve! label Sep 29, 2022
@ansibullbot ansibullbot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Sep 29, 2022
@github-actions
Copy link

Docs Build 📝

Thank you for contribution!✨

The docsite for this PR is available for download as an artifact from this run:
https://github.com/ansible-collections/community.general/actions/runs/3149001492

File changes:

  • M collections/community/general/proxmox_snap_module.html
Click to see the diff comparison.

NOTE: only file modifications are shown here. New and deleted files are excluded.
See the file list and check the published docs to see those files.

diff --git a/home/runner/work/community.general/community.general/docsbuild/base/collections/community/general/proxmox_snap_module.html b/home/runner/work/community.general/community.general/docsbuild/head/collections/community/general/proxmox_snap_module.html
index 84fb108..90e9154 100644
--- a/home/runner/work/community.general/community.general/docsbuild/base/collections/community/general/proxmox_snap_module.html
+++ b/home/runner/work/community.general/community.general/docsbuild/head/collections/community/general/proxmox_snap_module.html
@@ -271,6 +271,24 @@ see <a class="reference internal" href="#ansible-collections-community-general-p
 </div></td>
 </tr>
 <tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-unbind"></div><p class="ansible-option-title" id="ansible-collections-community-general-proxmox-snap-module-parameter-unbind"><strong>unbind</strong></p>
+<a class="ansibleOptionLink" href="#parameter-unbind" 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 community.general 5.7.0</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>This option only applies to LXC containers.</p>
+<p>Allows to snapshot a container even if it has configured mountpoints.</p>
+<p>Temporarily disables all configured mountpoints, takes snapshot, and finally restores original configuration.</p>
+<p>If running, the container will be stopped and restarted to apply config changes.</p>
+<p>Due to restrictions in the Proxmox API this option can only be used authenticating as <code class="docutils literal notranslate"><span class="pre">root&#64;pam</span></code> with <em>api_password</em>, API tokens do not work either.</p>
+<p>See <a class="reference external" href="https://pve.proxmox.com/pve-docs/api-viewer/#/nodes">https://pve.proxmox.com/pve-docs/api-viewer/#/nodes</a>/{node}/lxc/{vmid}/config (PUT tab) for more details.</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">false</span> <span class="ansible-option-default">← (default)</span></p></li>
+<li><p><span class="ansible-option-choices-entry">true</span></p></li>
+</ul>
+</div></td>
+</tr>
+<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-general-proxmox-snap-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>
@@ -283,7 +301,7 @@ see <a class="reference internal" href="#ansible-collections-community-general-p
 </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-vmid"></div><p class="ansible-option-title" id="ansible-collections-community-general-proxmox-snap-module-parameter-vmid"><strong>vmid</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vmid" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
@@ -291,7 +309,7 @@ see <a class="reference internal" href="#ansible-collections-community-general-p
 <p>If not set, will be fetched from PromoxAPI based on the hostname.</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-vmstate"></div><p class="ansible-option-title" id="ansible-collections-community-general-proxmox-snap-module-parameter-vmstate"><strong>vmstate</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vmstate" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
@@ -327,6 +345,16 @@ see <a class="reference internal" href="#ansible-collections-community-general-p
 <span class="w">    </span><span class="nt">state</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">present</span><span class="w"></span>
 <span class="w">    </span><span class="nt">snapname</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pre-updates</span><span class="w"></span>
 
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Create new snapshot for a container with configured mountpoints</span><span class="w"></span>
+<span class="w">  </span><span class="nt">community.general.proxmox_snap</span><span class="p">:</span><span class="w"></span>
+<span class="w">    </span><span class="nt">api_user</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">root@pam</span><span class="w"></span>
+<span class="w">    </span><span class="nt">api_password</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1q2w3e</span><span class="w"></span>
+<span class="w">    </span><span class="nt">api_host</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">node1</span><span class="w"></span>
+<span class="w">    </span><span class="nt">vmid</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">100</span><span class="w"></span>
+<span class="w">    </span><span class="nt">state</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">present</span><span class="w"></span>
+<span class="w">    </span><span class="nt">unbind</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span><span class="w"> </span><span class="c1"># requires root@pam+password auth, API tokens are not supported</span><span class="w"></span>
+<span class="w">    </span><span class="nt">snapname</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pre-updates</span><span class="w"></span>
+
 <span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Remove container snapshot</span><span class="w"></span>
 <span class="w">  </span><span class="nt">community.general.proxmox_snap</span><span class="p">:</span><span class="w"></span>
 <span class="w">    </span><span class="nt">api_user</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">root@pam</span><span class="w"></span>

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Sep 29, 2022
Signed-off-by: Christoph Fiehe <[email protected]>
@cfiehe cfiehe force-pushed the rhsm_fix_idempotency_with_pool_ids branch from 93d05ba to 2646d76 Compare September 29, 2022 11:31
@ansibullbot ansibullbot removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Sep 29, 2022
@cfiehe cfiehe closed this Sep 29, 2022
@cfiehe cfiehe deleted the rhsm_fix_idempotency_with_pool_ids branch September 29, 2022 11:37
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Sep 29, 2022
@felixfontein
Copy link
Collaborator

Continued in #5319.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug cloud module_utils module_utils module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR net_tools new_contributor Help guide this first time contributor os packaging plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants