Skip to content

Commit

Permalink
redhat_subscription: don't discard vars with key (#5627) (#5633)
Browse files Browse the repository at this point in the history
Fixes #3486. From the man-pages of subscription-manager, none of the
parameters used are tied to the activationkey except the two that remain
in its else-clause.

Note that type is not mentioned in the man-pages on 7.6 (at least), but
is still present and available.

Co-authored-by: Thor K. H <thor@roht.no>
(cherry picked from commit f7fa54e)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
  • Loading branch information
patchback[bot] and ptoscano authored Nov 30, 2022
1 parent efedd0d commit e1e89f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- redhat_subscription - do not ignore ``consumer_name`` and other variables if ``activationkey`` is specified
(https://github.com/ansible-collections/community.general/issues/3486, https://github.com/ansible-collections/community.general/pull/5627).
25 changes: 15 additions & 10 deletions plugins/modules/redhat_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,23 +411,28 @@ def register(self, username, password, auto_attach, activationkey, org_id,
if org_id:
args.extend(['--org', org_id])

if auto_attach:
args.append('--auto-attach')

if consumer_type:
args.extend(['--type', consumer_type])

if consumer_name:
args.extend(['--name', consumer_name])

if consumer_id:
args.extend(['--consumerid', consumer_id])

if environment:
args.extend(['--environment', environment])

if activationkey:
args.extend(['--activationkey', activationkey])
else:
if auto_attach:
args.append('--auto-attach')
if username:
args.extend(['--username', username])
if password:
args.extend(['--password', password])
if consumer_type:
args.extend(['--type', consumer_type])
if consumer_name:
args.extend(['--name', consumer_name])
if consumer_id:
args.extend(['--consumerid', consumer_id])
if environment:
args.extend(['--environment', environment])

if release:
args.extend(['--release', release])
Expand Down

0 comments on commit e1e89f7

Please sign in to comment.