summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Brown <sb@ryansb.com>2016-08-04 16:16:01 -0400
committerGitHub <noreply@github.com>2016-08-04 16:16:01 -0400
commit4f7996fbc1ea1657161713c5a818e0588aa37291 (patch)
tree2116fabdb8853780f109c6acf40ffa5235215e57
parent159aa26b36a6455ebc38d527c294c60899892c04 (diff)
parentfa1d55f6834a2fff32093c9e87436d416a15e147 (diff)
downloadansible-4f7996fbc1ea1657161713c5a818e0588aa37291.tar.gz
Merge pull request #16879 from alikins/gce_module_utils
Fix import of gce/gcdns without a libcloud module
-rw-r--r--lib/ansible/module_utils/gcdns.py3
-rw-r--r--lib/ansible/module_utils/gce.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/ansible/module_utils/gcdns.py b/lib/ansible/module_utils/gcdns.py
index 7227e9be66..c4b9cbd9db 100644
--- a/lib/ansible/module_utils/gcdns.py
+++ b/lib/ansible/module_utils/gcdns.py
@@ -40,11 +40,12 @@ except ImportError:
USER_AGENT_PRODUCT = "Ansible-gcdns"
USER_AGENT_VERSION = "v1"
-def gcdns_connect(module, provider=Provider.GOOGLE):
+def gcdns_connect(module, provider=None):
"""Return a GCP connection for Google Cloud DNS."""
if not HAS_LIBCLOUD_BASE:
module.fail_json(msg='libcloud must be installed to use this module')
+ provider = provider or Provider.GOOGLE
return gcp_connect(module, provider, get_driver, USER_AGENT_PRODUCT, USER_AGENT_VERSION)
def unexpected_error_msg(error):
diff --git a/lib/ansible/module_utils/gce.py b/lib/ansible/module_utils/gce.py
index 85717bb5c5..1084b9dccd 100644
--- a/lib/ansible/module_utils/gce.py
+++ b/lib/ansible/module_utils/gce.py
@@ -40,10 +40,11 @@ except ImportError:
USER_AGENT_PRODUCT = "Ansible-gce"
USER_AGENT_VERSION = "v1"
-def gce_connect(module, provider=Provider.GCE):
+def gce_connect(module, provider=None):
"""Return a GCP connection for Google Compute Engine."""
if not HAS_LIBCLOUD_BASE:
module.fail_json(msg='libcloud must be installed to use this module')
+ provider = provider or Provider.GCE
return gcp_connect(module, provider, get_driver, USER_AGENT_PRODUCT, USER_AGENT_VERSION)