redhat_subscription: replace deprecated autosubscribe (#30927)

pull/30796/merge
Martin Krizek 7 years ago committed by ansibot
parent 91bb211922
commit 55739c1e46

@ -81,11 +81,15 @@ options:
required: False required: False
default: Current value from C(/etc/rhsm/rhsm.conf) is the default default: Current value from C(/etc/rhsm/rhsm.conf) is the default
version_added: "2.4" version_added: "2.4"
autosubscribe: auto_attach:
description: description:
- Upon successful registration, auto-consume available subscriptions - Upon successful registration, auto-consume available subscriptions
- Added in favor of depracated autosubscribe in 2.5.
required: False required: False
default: False default: False
type: bool
version_added: "2.5"
aliases: [autosubscribe]
activationkey: activationkey:
description: description:
- supply an activation key for use with registration - supply an activation key for use with registration
@ -156,7 +160,7 @@ EXAMPLES = '''
state: present state: present
username: joe_user username: joe_user
password: somepass password: somepass
autosubscribe: true auto_attach: true
- name: Same as above but subscribe to a specific pool by ID. - name: Same as above but subscribe to a specific pool by ID.
redhat_subscription: redhat_subscription:
@ -210,7 +214,7 @@ EXAMPLES = '''
username: joe_user username: joe_user
password: somepass password: somepass
environment: Library environment: Library
autosubscribe: yes auto_attach: true
''' '''
RETURN = ''' RETURN = '''
@ -357,7 +361,7 @@ class Rhsm(RegistrationBase):
else: else:
return False return False
def register(self, username, password, autosubscribe, 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, rhsm_baseurl, server_insecure, server_hostname, server_proxy_hostname,
server_proxy_port, server_proxy_user, server_proxy_password): server_proxy_port, server_proxy_user, server_proxy_password):
@ -385,8 +389,8 @@ class Rhsm(RegistrationBase):
args.extend(['--activationkey', activationkey]) args.extend(['--activationkey', activationkey])
args.extend(['--org', org_id]) args.extend(['--org', org_id])
else: else:
if autosubscribe: if auto_attach:
args.append('--autosubscribe') args.append('--auto-attach')
if username: if username:
args.extend(['--username', username]) args.extend(['--username', username])
if password: if password:
@ -669,8 +673,7 @@ def main():
required=False), required=False),
rhsm_baseurl=dict(default=rhsm.config.get_option('rhsm.baseurl'), rhsm_baseurl=dict(default=rhsm.config.get_option('rhsm.baseurl'),
required=False), required=False),
autosubscribe=dict(default=False, auto_attach=dict(aliases=['autosubscribe'], default=False, type='bool'),
type='bool'),
activationkey=dict(default=None, activationkey=dict(default=None,
required=False), required=False),
org_id=dict(default=None, org_id=dict(default=None,
@ -714,7 +717,7 @@ def main():
server_hostname = module.params['server_hostname'] server_hostname = module.params['server_hostname']
server_insecure = module.params['server_insecure'] server_insecure = module.params['server_insecure']
rhsm_baseurl = module.params['rhsm_baseurl'] rhsm_baseurl = module.params['rhsm_baseurl']
autosubscribe = module.params['autosubscribe'] auto_attach = module.params['auto_attach']
activationkey = module.params['activationkey'] activationkey = module.params['activationkey']
org_id = module.params['org_id'] org_id = module.params['org_id']
environment = module.params['environment'] environment = module.params['environment']
@ -762,7 +765,7 @@ def main():
try: try:
rhsm.enable() rhsm.enable()
rhsm.configure(**module.params) rhsm.configure(**module.params)
rhsm.register(username, password, autosubscribe, 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, rhsm_baseurl, server_insecure, server_hostname,
server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password) server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password)

Loading…
Cancel
Save