summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils/gce.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix import of gce/gcdns without a libcloud moduleAdrian Likins2016-07-291-1/+2
| | | | | | | | | | | | The module level function defs for gcdns_connect() and gce_connect() provide a default arg for 'provider' that references into the libcloud module. If the libcloud modules were not installed, the gce/gcdns python modules would throw ImportError. Let the provider arg default to None and if not provided, set it to the default libcloud.compute.types.Provider.* value if the modules are installed.
* Refactored gce util module to support other GCP services (#15924)William Albert2016-07-281-82/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactoring of the existing GCE utility module to support other projects on Google Cloud Platform. The previous gce.py module was hard-coded specifically for GCE, and attempting to use it with other projects in GCP failed. See https://github.com/ansible/ansible/pull/15918#issuecomment-220165913 for more detail. This has also been an issue for others in the past, although they've handled it by simply duplicating some of the logic of gce.py in their own modules. - The existing gce.py module was renamed to gcp.py, and modified to remove any imports or other code that refers to libcloud.compute or GCE (the GCE_* params were retained for compatibility). I also renamed the gce_connect function to gcp_connect, and modified the function signature to make supplying a provider, driver, and agent information mandatory. - A new gce.py module was created to handle connectivity to GCE. It imports the appropriate libcloud.compute providers and drivers, and then passes them on to gcp_connect in gcp.py. The constants and function signatures are the same as the old gce.py, so compatibility with existing modules is retained. - A new gcdns.py module was created to support PR ansible/ansible-modules-extras#2252 for two new Google Cloud DNS modules, and to demonstrate support for a non-GCE Google Cloud service. It follows the same basic structure as the new gce.py module, but imports from libcloud.dns instead.
* Port the gce snippet to a python 2.6 to 3 compatible syntax (#15872)Michael Scherer2016-05-161-3/+3
| | | | | | Since it depend on libcloud and libcloud requirements include python 2.6 since libcloud 0.4.0 (https://libcloud.apache.org/about.html), which was released in 2011 Q2, and GCE drivers were added in 2013, we can't run a libcloud version with GCE support on 2.4.
* Fixed importing the libcloud modules to give a nice error rather than a ↵Toshio Kuratomi2016-05-121-4/+10
| | | | traceback.
* Update GCE module to use JSON credentials (#13623)Vic Iglesias2016-05-121-4/+27
| | | | | | | | * Update GCE module to use JSON credentials * Ensure minimum libcloud version when using JSON crednetials for GCE * Relax langauge around libcloud requirements
* ZiploaderToshio Kuratomi2016-04-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Ziploader proof of concept (jimi-c) * Cleanups to proof of concept ziploader branch: * python3 compatible base64 encoding * zipfile compression (still need to enable toggling this off for systems without zlib support in python) * Allow non-wildcard imports (still need to make this recusrsive so that we can have module_utils code that imports other module_utils code.) * Better tracebacks: module filename is kept and module_utils directory is kept so that tracebacks show the real filenames that the errors appear in. * Make sure we import modules that are used into the module_utils files that they are used in. * Set ansible version in a more pythonic way for ziploader than we were doing in module replacer * Make it possible to set the module compression as an inventory var This may be necessary on systems where python has been compiled without zlib compression. * Refactoring of module_common code: * module replacer only replaces values that make sense for that type of file (example: don't attempt to replace python imports if we're in a powershell module). * Implement configurable shebang support for ziploader wrapper * Implement client-side constants (for SELINUX_SPECIAL_FS and SYSLOG) via environment variable. * Remove strip_comments param as we're never going to use it (ruins line numbering) * Don't repeat ourselves about detecting REPLACER * Add an easy way to debug * Port test-module to the ziploader-aware modify_module() * strip comments and blank lines from the wrapper so we send less over the wire. * Comments cleanup * Remember to output write the module line itself in powershell modules * for line in lines strips the newlines so we have to add them back in
* fix gce module error reportingnitzmahone2015-11-121-2/+2
| | | | Error reporting was broken for GCE modules- pprint didn't work with exceptions, so you'd always get "Unexpected response: {}" instead of the real error.
* Add imports for stdlib modules that are used.Toshio Kuratomi2015-11-021-0/+1
| | | | This is cleanup that will aid us when we get ziploader implemented for 2.1
* fix some warning of undefined name.soarpenguin2015-10-091-0/+1
|
* Google: allow for different libcloud provider to support upcoming DNS moduleEric Johnson2014-10-291-2/+8
|
* Add support for environment variables in GCE module.Luke Sneeringer2014-08-011-4/+22
|
* Moved import to the topNacho Coloma2014-07-281-1/+2
|
* Bugfix: bulletproof unexpected_error_msg at gce.pyNacho Coloma2014-07-231-4/+2
| | | | | | | | | This method was still failing for me with a "missing http_code" message. After applying this change, the error message is: ``` msg: Unexpected response: {'value': 'PyCrypto library required for Service Account Authentication.'} ``` I wanted to contribute a rock-solid `unexpected_error_msg` implementation.
* Add BSD license to module_utils/gce.pyFranck Cuny2014-03-101-0/+29
|
* Add credential parameters to the GCE modules.Franck Cuny2014-03-041-0/+41
In order to simplify the workflow with the GCE modules, it's now possible to add the parameters and project name as arguments to the various GCE modules. The inventory plugin also returns the IP of the host in `ansible_ssh_host` so that you don't have to specify IPs into the inventory file. Some update to the documentation are also added. Closes #5583.