From d2782f0d84c4e344c18f647b1ac3bfd903d75366 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 11 May 2015 08:06:21 -0400 Subject: [PATCH] Remove unneeded required_one_of for openstack We're being too strict - there is a third possibility, which is that a user will have defined the OS_* environment variables and expect them to pass through. --- lib/ansible/module_utils/openstack.py | 6 +----- lib/ansible/utils/module_docs_fragments/openstack.py | 7 +++++-- v2/ansible/module_utils/openstack.py | 6 +----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/ansible/module_utils/openstack.py b/lib/ansible/module_utils/openstack.py index b58cc53428..4069449144 100644 --- a/lib/ansible/module_utils/openstack.py +++ b/lib/ansible/module_utils/openstack.py @@ -93,11 +93,7 @@ def openstack_full_argument_spec(**kwargs): def openstack_module_kwargs(**kwargs): - ret = dict( - required_one_of=[ - ['cloud', 'auth'], - ], - ) + ret = {} for key in ('mutually_exclusive', 'required_together', 'required_one_of'): if key in kwargs: if key in ret: diff --git a/lib/ansible/utils/module_docs_fragments/openstack.py b/lib/ansible/utils/module_docs_fragments/openstack.py index 7e42841d6d..3dff423772 100644 --- a/lib/ansible/utils/module_docs_fragments/openstack.py +++ b/lib/ansible/utils/module_docs_fragments/openstack.py @@ -23,7 +23,9 @@ class ModuleDocFragment(object): options: cloud: description: - - Named cloud to operate against. Provides default values for I(auth) and I(auth_plugin) + - Named cloud to operate against. Provides default values for I(auth) and + I(auth_type). This parameter is not needed if I(auth) is provided or if + OpenStack OS_* environment variables are present. required: false auth: description: @@ -32,7 +34,8 @@ options: I(auth_url), I(username), I(password), I(project_name) and any information about domains if the cloud supports them. For other plugins, this param will need to contain whatever parameters that auth plugin - requires. This parameter is not needed if a named cloud is provided. + requires. This parameter is not needed if a named cloud is provided or + OpenStack OS_* environment variables are present. required: false auth_type: description: diff --git a/v2/ansible/module_utils/openstack.py b/v2/ansible/module_utils/openstack.py index b58cc53428..4069449144 100644 --- a/v2/ansible/module_utils/openstack.py +++ b/v2/ansible/module_utils/openstack.py @@ -93,11 +93,7 @@ def openstack_full_argument_spec(**kwargs): def openstack_module_kwargs(**kwargs): - ret = dict( - required_one_of=[ - ['cloud', 'auth'], - ], - ) + ret = {} for key in ('mutually_exclusive', 'required_together', 'required_one_of'): if key in kwargs: if key in ret: