Skip to content

Commit

Permalink
[PR #6676/ffb9b6ff backport][stable-7] rhsm_repository: update return…
Browse files Browse the repository at this point in the history
…ed "repositories" when using "purge=true" (#6746)

rhsm_repository: update returned "repositories" when using "purge=true" (#6676)

In case the "purge" option was enabled, the "repositories" element in
the returned JSON was not updated with the repositories disabled by that
option.

(cherry picked from commit ffb9b6f)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
  • Loading branch information
patchback[bot] and ptoscano authored Jun 20, 2023
1 parent cbb29fe commit c35d8b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bugfixes:
- |
rhsm_repository - when using the ``purge`` option, the ``repositories``
dictionary element in the returned JSON is now properly updated according
to the pruning operation
(https://github.com/ansible-collections/community.general/pull/6676).
3 changes: 3 additions & 0 deletions plugins/modules/rhsm_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ def repository_modify(module, state, name, purge=False):
diff_after.join("Repository '{repoid}' is disabled for this system\n".format(repoid=repoid))
results.append("Repository '{repoid}' is disabled for this system".format(repoid=repoid))
rhsm_arguments.extend(['--disable', repoid])
for updated_repo in updated_repo_list:
if updated_repo['id'] in difference:
updated_repo['enabled'] = False

diff = {'before': diff_before,
'after': diff_after,
Expand Down

0 comments on commit c35d8b5

Please sign in to comment.