[PR #6211/9f67cbbe backport][stable-6] rhsm modules: cleanly fail when not run as root #6218
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.
This is a backport of PR #6211 as merged into main (9f67cbb).
SUMMARY
subscription-manager
on RHEL installs a symlink in/usr/bin
toconsole-helper
(part of usermode), which triggers an interactive prompt for root credentials when run as user. It seems thatconsole-helper
does not handle well non-interactive contexts (e.g. without a TTY for input), and thus it will hang waiting for input when run as user in an Ansible task.Since
subscription-manager
requires root already anyway (and it will fail when explicitly run as user), then apply the same logic locally on all the modules that interact with it:redhat_subscription
,rhsm_release
, andrhsm_repository
.Fixes #734
ISSUE TYPE
COMPONENT NAME
redhat_subscription
ADDITIONAL INFORMATION
A simple reproducer is running any of
redhat_subscription
,rhsm_release
, orrhsm_repository
without any privilege escalation (i.e.become
).