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
parent 434e9e1d8f
commit 42deaf2c71

View file

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