mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #16879 from alikins/gce_module_utils
Fix import of gce/gcdns without a libcloud module
This commit is contained in:
commit
4f7996fbc1
2 changed files with 4 additions and 2 deletions
|
@ -40,11 +40,12 @@ except ImportError:
|
||||||
USER_AGENT_PRODUCT = "Ansible-gcdns"
|
USER_AGENT_PRODUCT = "Ansible-gcdns"
|
||||||
USER_AGENT_VERSION = "v1"
|
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."""
|
"""Return a GCP connection for Google Cloud DNS."""
|
||||||
if not HAS_LIBCLOUD_BASE:
|
if not HAS_LIBCLOUD_BASE:
|
||||||
module.fail_json(msg='libcloud must be installed to use this module')
|
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)
|
return gcp_connect(module, provider, get_driver, USER_AGENT_PRODUCT, USER_AGENT_VERSION)
|
||||||
|
|
||||||
def unexpected_error_msg(error):
|
def unexpected_error_msg(error):
|
||||||
|
|
|
@ -40,10 +40,11 @@ except ImportError:
|
||||||
USER_AGENT_PRODUCT = "Ansible-gce"
|
USER_AGENT_PRODUCT = "Ansible-gce"
|
||||||
USER_AGENT_VERSION = "v1"
|
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."""
|
"""Return a GCP connection for Google Compute Engine."""
|
||||||
if not HAS_LIBCLOUD_BASE:
|
if not HAS_LIBCLOUD_BASE:
|
||||||
module.fail_json(msg='libcloud must be installed to use this module')
|
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)
|
return gcp_connect(module, provider, get_driver, USER_AGENT_PRODUCT, USER_AGENT_VERSION)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue