Commit Graph

16 Commits (7b167e7947ddc75ce200b66b2a0c8df9a272d7a9)

Author SHA1 Message Date
Matt Clay 10d9318de7 PEP 8 indent cleanup. (#20800)
* PEP 8 E121 cleanup.

* PEP 8 E126 cleanup.

* PEP 8 E122 cleanup.
8 years ago
Matt Clay d0d1158c5e PEP 8 cleanup. (#20789)
* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
8 years ago
Carlos E. Garcia 0b8011436d minor spelling changes 8 years ago
Tom Melendez 9400ba1728 [GCE] inventory script supports paginated API results. (#18554)
The inventory script now supports paginated results.  This means that inventory may exceed 500 instances.
8 years ago
James Tanner 2d2bb626d4 Port has_key to python3 compatible syntax 8 years ago
Tom Melendez 54caf3c5d5 [GCE] Caching support for inventory script. (#18093)
* [GCE] Caching support for inventory script.

The GCE inventory script now supports reading from a cache rather than making the request each time.  The format of the list and host output have not changed.

On script execution, the cache is checked to see if it older than 'cache_max_age', and if so, it is rebuilt (it can also be explicity rebuilt).

To support this functionality, the following have been added.

* Config file (gce.ini) changes: A new 'cache' section has been added to the config file, with 'cache_path' and 'cache_max_age' options to allow for configuration.  There are intelligent defaults in place if that section and options are not found in the configuration file.

* Command line argument: A new --refresh-cache argument has been added to force the cache to be rebuild.

* A CloudInventoryCache class, contained in the same file has been added.  As a seperate class, it allowed for testing (unit tests not included in this PR) and hopefully could be re-used in the future (it contains borrowed code from other inventory scripts)

* load_inventory_from_cache and do_api_calls_and_update_cache methods (, which were largely lifted from other inventory scripts, in a hope to promote consistency in the future) to determine if the cache is fresh and rebuild if necessary.

* A 'main' check, to support the script being imported and testable.

A new dictionary has been added to the list output, located at ['_meta']['stats'] that informs if the cache was used and how long it took to load the inventory (in 'cache_used' and 'inventory_load_time', respectively).

* fixed default value error; change cache time to 300
8 years ago
Adrian Likins 57a911e098 Use sys.exit(msg) i/o print() and sys.exit() (#15465)
Any non-0 exits should be showing an error message
to stderr instead of to stdout.
8 years ago
Wayne Witzel III bb8d1168ac Added the ability to filter gce grouped_instances by region/zone (#14138) 8 years ago
Kenny Woodson ebf1feb5bb Adding instance_states option to gce inventory 9 years ago
Matt Hite fbfc24fb40 New inventory_ip_type option in gce inventory tool 9 years ago
Vlad Panainte 8259c091d6 fix logging 9 years ago
Marius Gedminas 3f9879aedb Use print() as function under contrib/
This fixes the remaining Python 3 syntax errors, so re-enable compileall
for contrib/ again.
9 years ago
Marius Gedminas 9ae66a7f5c Use 'except ... as' syntax in contrib/ and test/ too 9 years ago
Mathieu Lecarme 1873e8ed08 GCE tag prefix for creating ansible group. 9 years ago
Brian Coca 9c5a6d7b5a fixed all references to old plugins/inventory to point at contrib/inventory 9 years ago
Brian Coca d0c6d2ff1c poreted log_plays, syslog_json and osx_say callbacks to v2
renamed plugins to contrib (they are not really plugins)
rewrote README.md to reflect new usage
added new dir to setup.py so it gets copied with installation, in views
of making using inventory scripts easier in teh future
9 years ago