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

redhat_subscription: use CLI when using environments #6319

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bugfixes:
- redhat_subscription - do not use D-Bus for registering when ``environment`` is specified,
so it possible to specify again the environment names for registering,
as the D-Bus APIs work only with IDs
(https://github.com/ansible-collections/community.general/pull/6319).
6 changes: 4 additions & 2 deletions plugins/modules/redhat_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,10 @@ def register(self, was_registered, username, password, token, auto_attach, activ
* Exception - if any error occurs during the registration
'''
# There is no support for token-based registration in the D-Bus API
# of rhsm, so always use the CLI in that case.
if not token and self._can_connect_to_dbus():
# of rhsm, so always use the CLI in that case;
# also, since the specified environments are names, and the D-Bus APIs
# require IDs for the environments, use the CLI also in that case
if not token and not environment and self._can_connect_to_dbus():
self._register_using_dbus(was_registered, username, password, auto_attach,
activationkey, org_id, consumer_type,
consumer_name, consumer_id,
Expand Down