-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
rhsm_repository: refactor handling of subscription-manager #6783
Merged
felixfontein
merged 1 commit into
ansible-collections:main
from
ptoscano:rhsm_repository-refactor-subman
Jul 2, 2023
Merged
rhsm_repository: refactor handling of subscription-manager #6783
felixfontein
merged 1 commit into
ansible-collections:main
from
ptoscano:rhsm_repository-refactor-subman
Jul 2, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as outdated.
This comment was marked as outdated.
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.
bb97463
to
93a2955
Compare
Backport to stable-7: 💚 backport PR created✅ Backport PR branch: Backported as #6830 🤖 @patchback |
patchback bot
pushed a commit
that referenced
this pull request
Jul 2, 2023
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 867704d)
Thanks for improving the module! |
felixfontein
pushed a commit
that referenced
this pull request
Jul 2, 2023
…ling 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 867704d) Co-authored-by: Pino Toscano <ptoscano@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Create a small helper class
Rhsm
, so all the logic related to the interaction with subscription-manager is grouped there:Rhsm
object inmain()
, once the initial checks are donesubscription-manager
as required (so there is no need to manually check it), and store its path for reusesubscription-manager
run_subscription_manager()
toRhsm
asrun_repos()
get_repository_list()
toRhsm
aslist_repositories()
The execution of
subscription-manager
is improved as well:run_command()
directly as list, rather than joining the arguments to string, whichrun_command()
will need to split againrepos
parameter directly inrun_repos()
Adapt the unit test to the different way
run_command()
is called.There should be no behaviour changes.
ISSUE TYPE
COMPONENT NAME
rhsm_repository