Merge branch 'nixpanic-rhsm/org_id' into devel

reviewable/pr18780/r1
James Cammarata 10 years ago
commit 74e69d1fd1

@ -54,6 +54,12 @@ options:
- supply an activation key for use with registration - supply an activation key for use with registration
required: False required: False
default: null default: null
org_id:
description:
- Organisation ID to use in conjunction with activationkey
required: False
default: null
version_added: "2.0"
pool: pool:
description: description:
- Specify a subscription pool name to consume. Regular expressions accepted. - Specify a subscription pool name to consume. Regular expressions accepted.
@ -197,7 +203,7 @@ class Rhsm(RegistrationBase):
else: else:
return False return False
def register(self, username, password, autosubscribe, activationkey): def register(self, username, password, autosubscribe, activationkey, org_id):
''' '''
Register the current system to the provided RHN server Register the current system to the provided RHN server
Raises: Raises:
@ -208,6 +214,8 @@ class Rhsm(RegistrationBase):
# Generate command arguments # Generate command arguments
if activationkey: if activationkey:
args.extend(['--activationkey', activationkey]) args.extend(['--activationkey', activationkey])
if org_id:
args.extend(['--org', org_id])
else: else:
if autosubscribe: if autosubscribe:
args.append('--autosubscribe') args.append('--autosubscribe')
@ -339,6 +347,7 @@ def main():
rhsm_baseurl = dict(default=rhn.config.get_option('rhsm.baseurl'), required=False), rhsm_baseurl = dict(default=rhn.config.get_option('rhsm.baseurl'), required=False),
autosubscribe = dict(default=False, type='bool'), autosubscribe = dict(default=False, type='bool'),
activationkey = dict(default=None, required=False), activationkey = dict(default=None, required=False),
org_id = dict(default=None, required=False),
pool = dict(default='^$', required=False, type='str'), pool = dict(default='^$', required=False, type='str'),
) )
) )
@ -352,6 +361,7 @@ def main():
rhsm_baseurl = module.params['rhsm_baseurl'] rhsm_baseurl = module.params['rhsm_baseurl']
autosubscribe = module.params['autosubscribe'] == True autosubscribe = module.params['autosubscribe'] == True
activationkey = module.params['activationkey'] activationkey = module.params['activationkey']
org_id = module.params['org_id']
pool = module.params['pool'] pool = module.params['pool']
# Ensure system is registered # Ensure system is registered
@ -370,7 +380,7 @@ def main():
try: try:
rhn.enable() rhn.enable()
rhn.configure(**module.params) rhn.configure(**module.params)
rhn.register(username, password, autosubscribe, activationkey) rhn.register(username, password, autosubscribe, activationkey, org_id)
rhn.subscribe(pool) rhn.subscribe(pool)
except Exception, e: except Exception, e:
module.fail_json(msg="Failed to register with '%s': %s" % (server_hostname, e)) module.fail_json(msg="Failed to register with '%s': %s" % (server_hostname, e))

Loading…
Cancel
Save