From 55739c1e46209dce06702586a0651e8b92a9d384 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Wed, 27 Sep 2017 08:33:00 +0200 Subject: [PATCH] redhat_subscription: replace deprecated autosubscribe (#30927) --- .../packaging/os/redhat_subscription.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/packaging/os/redhat_subscription.py b/lib/ansible/modules/packaging/os/redhat_subscription.py index 37af250e89..0d543cc173 100644 --- a/lib/ansible/modules/packaging/os/redhat_subscription.py +++ b/lib/ansible/modules/packaging/os/redhat_subscription.py @@ -81,11 +81,15 @@ options: required: False default: Current value from C(/etc/rhsm/rhsm.conf) is the default version_added: "2.4" - autosubscribe: + auto_attach: description: - Upon successful registration, auto-consume available subscriptions + - Added in favor of depracated autosubscribe in 2.5. required: False default: False + type: bool + version_added: "2.5" + aliases: [autosubscribe] activationkey: description: - supply an activation key for use with registration @@ -156,7 +160,7 @@ EXAMPLES = ''' state: present username: joe_user password: somepass - autosubscribe: true + auto_attach: true - name: Same as above but subscribe to a specific pool by ID. redhat_subscription: @@ -210,7 +214,7 @@ EXAMPLES = ''' username: joe_user password: somepass environment: Library - autosubscribe: yes + auto_attach: true ''' RETURN = ''' @@ -357,7 +361,7 @@ class Rhsm(RegistrationBase): else: 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, rhsm_baseurl, server_insecure, server_hostname, server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password): @@ -385,8 +389,8 @@ class Rhsm(RegistrationBase): args.extend(['--activationkey', activationkey]) args.extend(['--org', org_id]) else: - if autosubscribe: - args.append('--autosubscribe') + if auto_attach: + args.append('--auto-attach') if username: args.extend(['--username', username]) if password: @@ -669,8 +673,7 @@ def main(): required=False), rhsm_baseurl=dict(default=rhsm.config.get_option('rhsm.baseurl'), required=False), - autosubscribe=dict(default=False, - type='bool'), + auto_attach=dict(aliases=['autosubscribe'], default=False, type='bool'), activationkey=dict(default=None, required=False), org_id=dict(default=None, @@ -714,7 +717,7 @@ def main(): server_hostname = module.params['server_hostname'] server_insecure = module.params['server_insecure'] rhsm_baseurl = module.params['rhsm_baseurl'] - autosubscribe = module.params['autosubscribe'] + auto_attach = module.params['auto_attach'] activationkey = module.params['activationkey'] org_id = module.params['org_id'] environment = module.params['environment'] @@ -762,7 +765,7 @@ def main(): try: rhsm.enable() 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, environment, rhsm_baseurl, server_insecure, server_hostname, server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password)