mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
redhat_subscription: drop unneeded args to Rhsm.register() (#5583)
Stop passing all the "rhsm_", and "server_" module arguments to "Rhsm.register()", and thus as arguments for "subscription-manager register": - right before calling "Rhsm.register()", "Rhsm.configure()" is called to configure subscription-manager with all the "rhsm_", and "server_" arguments; hence, they are already configured - the passed argument to "--serverurl" is partially wrong: "Rhsm.register()" passes only the hostname, whereas the other bits (port and prefix) are supported too; this "works" because port and prefix were already configured previously, and the lax parsing that subscription-manager does allows for missing bits - the parsing done by subscription-manager for "--baseurl" strips out the URL scheme and always uses https: this means that specifying "rhsm_baseurl: http://server" as module parameter will be taken as "https://server" by subscription-manager; since "rhsm_baseurl" is already configured by "Rhsm.configure()", this issue is gone
This commit is contained in:
parent
53da86c1a5
commit
101c957631
3 changed files with 5 additions and 27 deletions
|
@ -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).
|
|
@ -394,8 +394,7 @@ class Rhsm(RegistrationBase):
|
||||||
|
|
||||||
def register(self, username, password, auto_attach, activationkey, org_id,
|
def register(self, username, password, auto_attach, activationkey, org_id,
|
||||||
consumer_type, consumer_name, consumer_id, force_register, environment,
|
consumer_type, consumer_name, consumer_id, force_register, environment,
|
||||||
rhsm_baseurl, server_insecure, server_hostname, server_proxy_hostname,
|
release):
|
||||||
server_proxy_port, server_proxy_user, server_proxy_password, release):
|
|
||||||
'''
|
'''
|
||||||
Register the current system to the provided RHSM or Red Hat Satellite
|
Register the current system to the provided RHSM or Red Hat Satellite
|
||||||
or Katello server
|
or Katello server
|
||||||
|
@ -409,27 +408,9 @@ class Rhsm(RegistrationBase):
|
||||||
if force_register:
|
if force_register:
|
||||||
args.extend(['--force'])
|
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:
|
if org_id:
|
||||||
args.extend(['--org', 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:
|
if activationkey:
|
||||||
args.extend(['--activationkey', activationkey])
|
args.extend(['--activationkey', activationkey])
|
||||||
else:
|
else:
|
||||||
|
@ -924,8 +905,7 @@ def main():
|
||||||
rhsm.configure(**module.params)
|
rhsm.configure(**module.params)
|
||||||
rhsm.register(username, password, auto_attach, activationkey, org_id,
|
rhsm.register(username, password, auto_attach, activationkey, org_id,
|
||||||
consumer_type, consumer_name, consumer_id, force_register,
|
consumer_type, consumer_name, consumer_id, force_register,
|
||||||
environment, rhsm_baseurl, server_insecure, server_hostname,
|
environment, release)
|
||||||
server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password, release)
|
|
||||||
if syspurpose and 'sync' in syspurpose and syspurpose['sync'] is True:
|
if syspurpose and 'sync' in syspurpose and syspurpose['sync'] is True:
|
||||||
rhsm.sync_syspurpose()
|
rhsm.sync_syspurpose()
|
||||||
if pool_ids:
|
if pool_ids:
|
||||||
|
|
|
@ -92,7 +92,6 @@ TEST_CASES = [
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
['/testbin/subscription-manager', 'register',
|
['/testbin/subscription-manager', 'register',
|
||||||
'--serverurl', 'satellite.company.com',
|
|
||||||
'--username', 'admin',
|
'--username', 'admin',
|
||||||
'--password', 'admin'],
|
'--password', 'admin'],
|
||||||
{'check_rc': True, 'expand_user_and_vars': False},
|
{'check_rc': True, 'expand_user_and_vars': False},
|
||||||
|
@ -180,7 +179,6 @@ TEST_CASES = [
|
||||||
[
|
[
|
||||||
'/testbin/subscription-manager',
|
'/testbin/subscription-manager',
|
||||||
'register',
|
'register',
|
||||||
'--serverurl', 'satellite.company.com',
|
|
||||||
'--org', 'admin',
|
'--org', 'admin',
|
||||||
'--activationkey', 'some-activation-key'
|
'--activationkey', 'some-activation-key'
|
||||||
],
|
],
|
||||||
|
@ -340,9 +338,6 @@ TEST_CASES = [
|
||||||
'register',
|
'register',
|
||||||
'--force',
|
'--force',
|
||||||
'--org', 'admin',
|
'--org', 'admin',
|
||||||
'--proxy', 'proxy.company.com:12345',
|
|
||||||
'--proxyuser', 'proxy_user',
|
|
||||||
'--proxypassword', 'secret_proxy_password',
|
|
||||||
'--username', 'admin',
|
'--username', 'admin',
|
||||||
'--password', 'admin'
|
'--password', 'admin'
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue