diff --git a/changelogs/fragments/5583-redhat_subscription-subscribe-parameters.yaml b/changelogs/fragments/5583-redhat_subscription-subscribe-parameters.yaml new file mode 100644 index 0000000000..bef3676c3b --- /dev/null +++ b/changelogs/fragments/5583-redhat_subscription-subscribe-parameters.yaml @@ -0,0 +1,3 @@ +bugfixes: + - redhat_subscription - do not pass arguments to ``subscription-manager register`` for things already configured; now a specified ``rhsm_baseurl`` is properly set for subscription-manager + (https://github.com/ansible-collections/community.general/pull/5583). diff --git a/plugins/modules/redhat_subscription.py b/plugins/modules/redhat_subscription.py index aaf39d6d3f..bb21578fa5 100644 --- a/plugins/modules/redhat_subscription.py +++ b/plugins/modules/redhat_subscription.py @@ -394,8 +394,7 @@ class Rhsm(RegistrationBase): def register(self, username, password, auto_attach, activationkey, org_id, consumer_type, consumer_name, consumer_id, force_register, environment, - rhsm_baseurl, server_insecure, server_hostname, server_proxy_hostname, - server_proxy_port, server_proxy_user, server_proxy_password, release): + release): ''' Register the current system to the provided RHSM or Red Hat Satellite or Katello server @@ -409,27 +408,9 @@ class Rhsm(RegistrationBase): if force_register: args.extend(['--force']) - if rhsm_baseurl: - args.extend(['--baseurl', rhsm_baseurl]) - - if server_insecure: - args.extend(['--insecure']) - - if server_hostname: - args.extend(['--serverurl', server_hostname]) - if org_id: args.extend(['--org', org_id]) - if server_proxy_hostname and server_proxy_port: - args.extend(['--proxy', server_proxy_hostname + ':' + server_proxy_port]) - - if server_proxy_user: - args.extend(['--proxyuser', server_proxy_user]) - - if server_proxy_password: - args.extend(['--proxypassword', server_proxy_password]) - if activationkey: args.extend(['--activationkey', activationkey]) else: @@ -924,8 +905,7 @@ def main(): rhsm.configure(**module.params) rhsm.register(username, password, auto_attach, activationkey, org_id, consumer_type, consumer_name, consumer_id, force_register, - environment, rhsm_baseurl, server_insecure, server_hostname, - server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password, release) + environment, release) if syspurpose and 'sync' in syspurpose and syspurpose['sync'] is True: rhsm.sync_syspurpose() if pool_ids: diff --git a/tests/unit/plugins/modules/test_redhat_subscription.py b/tests/unit/plugins/modules/test_redhat_subscription.py index bf65671419..f38f1ffe0d 100644 --- a/tests/unit/plugins/modules/test_redhat_subscription.py +++ b/tests/unit/plugins/modules/test_redhat_subscription.py @@ -92,7 +92,6 @@ TEST_CASES = [ ), ( ['/testbin/subscription-manager', 'register', - '--serverurl', 'satellite.company.com', '--username', 'admin', '--password', 'admin'], {'check_rc': True, 'expand_user_and_vars': False}, @@ -180,7 +179,6 @@ TEST_CASES = [ [ '/testbin/subscription-manager', 'register', - '--serverurl', 'satellite.company.com', '--org', 'admin', '--activationkey', 'some-activation-key' ], @@ -340,9 +338,6 @@ TEST_CASES = [ 'register', '--force', '--org', 'admin', - '--proxy', 'proxy.company.com:12345', - '--proxyuser', 'proxy_user', - '--proxypassword', 'secret_proxy_password', '--username', 'admin', '--password', 'admin' ],