updating argument validation for activation keys to match subscription-manager command line, fixes #27283 (#30236)

This commit is contained in:
James Molet 2017-10-13 08:59:49 -04:00 committed by ansibot
commit 42deaf2c71

View file

@ -385,9 +385,11 @@ class Rhsm(RegistrationBase):
if server_hostname: if server_hostname:
args.extend(['--serverurl', server_hostname]) args.extend(['--serverurl', server_hostname])
if org_id:
args.extend(['--org', org_id])
if activationkey: if activationkey:
args.extend(['--activationkey', activationkey]) args.extend(['--activationkey', activationkey])
args.extend(['--org', org_id])
else: else:
if auto_attach: if auto_attach:
args.append('--auto-attach') args.append('--auto-attach')
@ -704,9 +706,17 @@ def main():
required=False, required=False,
no_log=True), no_log=True),
), ),
required_together=[['username', 'password'], ['activationkey', 'org_id'], required_together=[['username', 'password'],
['server_proxy_hostname', 'server_proxy_port'], ['server_proxy_user', 'server_proxy_password']], ['server_proxy_hostname', 'server_proxy_port'],
mutually_exclusive=[['username', 'activationkey'], ['pool', 'pool_ids']], ['server_proxy_user', 'server_proxy_password']],
mutually_exclusive=[['activationkey', 'username'],
['activationkey', 'consumer_id'],
['activationkey', 'environment'],
['activationkey', 'autosubscribe'],
['force', 'consumer_id'],
['pool', 'pool_ids']],
required_if=[['state', 'present', ['username', 'activationkey'], True]], required_if=[['state', 'present', ['username', 'activationkey'], True]],
) )
@ -720,6 +730,8 @@ def main():
auto_attach = module.params['auto_attach'] 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']
if activationkey and not org_id:
module.fail_json(msg='org_id is required when using activationkey')
environment = module.params['environment'] environment = module.params['environment']
pool = module.params['pool'] pool = module.params['pool']
pool_ids = {} pool_ids = {}