Merge "Do not require ironic_url if cloud or auth.endpoint is provided"

This commit is contained in:
Zuul
2020-07-28 18:06:27 +00:00
committed by Gerrit Code Review
3 changed files with 28 additions and 10 deletions

View File

@@ -102,15 +102,21 @@ def main():
module = AnsibleModule(argument_spec, **module_kwargs)
if (
module.params['auth_type'] in [None, 'None']
module.params['auth_type'] in [None, 'None', 'none']
and module.params['ironic_url'] is None
and not module.params['cloud']
and not (module.params['auth']
and module.params['auth'].get('endpoint'))
):
module.fail_json(msg="Authentication appears to be disabled, "
"Please define an ironic_url parameter")
"Please define either ironic_url, or cloud, "
"or auth.endpoint")
if (
module.params['ironic_url']
and module.params['auth_type'] in [None, 'None']
and module.params['auth_type'] in [None, 'None', 'none']
and not (module.params['auth']
and module.params['auth'].get('endpoint'))
):
module.params['auth'] = dict(
endpoint=module.params['ironic_url']

View File

@@ -248,15 +248,21 @@ def main():
if not HAS_JSONPATCH:
module.fail_json(msg='jsonpatch is required for this module')
if (
module.params['auth_type'] in [None, 'None']
module.params['auth_type'] in [None, 'None', 'none']
and module.params['ironic_url'] is None
and not module.params['cloud']
and not (module.params['auth']
and module.params['auth'].get('endpoint'))
):
module.fail_json(msg="Authentication appears to be disabled, "
"Please define an ironic_url parameter")
"Please define either ironic_url, or cloud, "
"or auth.endpoint")
if (
module.params['ironic_url']
and module.params['auth_type'] in [None, 'None']
and module.params['auth_type'] in [None, 'None', 'none']
and not (module.params['auth']
and module.params['auth'].get('endpoint'))
):
module.params['auth'] = dict(
endpoint=module.params['ironic_url']

View File

@@ -245,15 +245,21 @@ def main():
module = AnsibleModule(argument_spec, **module_kwargs)
if (
module.params['auth_type'] in [None, 'None']
module.params['auth_type'] in [None, 'None', 'none']
and module.params['ironic_url'] is None
and not module.params['cloud']
and not (module.params['auth']
and module.params['auth'].get('endpoint'))
):
module.fail_json(msg="Authentication appears disabled, Please "
"define an ironic_url parameter")
module.fail_json(msg="Authentication appears to be disabled, "
"Please define either ironic_url, or cloud, "
"or auth.endpoint")
if (
module.params['ironic_url']
and module.params['auth_type'] in [None, 'None']
and module.params['auth_type'] in [None, 'None', 'none']
and not (module.params['auth']
and module.params['auth'].get('endpoint'))
):
module.params['auth'] = dict(
endpoint=module.params['ironic_url']