1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00
community.general/plugins
patchback[bot] 72d1af86f3
[PR #6783/867704dd backport][stable-7] rhsm_repository: refactor handling of subscription-manager (#6830)
rhsm_repository: refactor handling of subscription-manager (#6783)

Create a small helper class Rhsm, so all the logic related to the
interaction with subscription-manager is grouped there:
- create the Rhsm object in main(), once the initial checks are done
- search subscription-manager as required (so there is no need to
  manually check it), and store its path for reuse
- store the common arguments for running subscription-manager
- move run_subscription_manager() to Rhsm as run_repos()
- get rid of the different list parameters: we list only all the
  repositories, so the other cases are not needed (and can be added
  easily, if needed)
- move get_repository_list() to Rhsm as list_repositories()

The execution of subscription-manager is improved as well:
- pass the arguments to run_command() directly as list, rather than
  joining the arguments to string, which run_command() will need to
  split again
- move the "repos" parameter directly in run_repos()
- explicitly disable the shell, already off by default
- disable the expansions of variables, as there are none

Adapt the unit test to the different way run_command() is called.

There should be no behaviour changes.

(cherry picked from commit 867704dd75)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
2023-07-02 22:01:53 +02:00
..
action Shutdown systemd without sysv (#6171) 2023-05-09 20:10:09 +02:00
become [PR #6627/011b2f8b backport][stable-7] Start using semantic markup (#6664) 2023-06-10 10:53:50 +02:00
cache [PR #6627/011b2f8b backport][stable-7] Start using semantic markup (#6664) 2023-06-10 10:53:50 +02:00
callback [PR #6627/011b2f8b backport][stable-7] Start using semantic markup (#6664) 2023-06-10 10:53:50 +02:00
connection Add 'inventory_hostname' to the jail plugin documentation (#6118) 2023-03-03 22:56:24 +01:00
doc_fragments [PR #6699/7ae8cc99 backport][stable-7] Semantic markup: use E() in more places (#6700) 2023-06-15 12:54:13 +02:00
filter [PR #6627/011b2f8b backport][stable-7] Start using semantic markup (#6664) 2023-06-10 10:53:50 +02:00
inventory [PR #6711/24f27a0b backport][stable-7] plugins/inventory/cobbler: Collect IP addresses for hosts and add opt… (#6727) 2023-06-19 08:01:37 +02:00
lookup [PR #6691/89ad18d1 backport][stable-7] random_string docs to say it's cryptographically secure (#6816) 2023-06-30 06:39:17 +02:00
module_utils [PR #6719/22efbcc6 backport][stable-7] Fixing bug in get_volume_inventory (#6792) 2023-06-27 07:08:08 +02:00
modules [PR #6783/867704dd backport][stable-7] rhsm_repository: refactor handling of subscription-manager (#6830) 2023-07-02 22:01:53 +02:00
test Fix more copyright lines, add more default copyright lines (#5095) 2022-08-08 14:24:58 +02:00