Commit Graph

226 Commits (6a6f13a5bda1798f25ef514e1fe4f86efc5020e2)

Author SHA1 Message Date
Matt Martz 5942de603d Legacy pep8 clean fixes for contrib and hacking (#21081) 8 years ago
Matt Martz 39ea50b731 pep8 fixes for recent packet_net inventory (#21066) 8 years ago
Tomáš Karásek db8fd95d68 Dynamic inventory for Packet host (https://packet.net) (#20635)
* Add dynamic inventory script and config for Packet.net

* The script and config have been shamelessly cargo
  culted from the `ec2.py` and `ec2.ini` dynamic inventory
  script.
* This is an initial version and could very well be
  enhanced and made better.

Examples:

`PACKET_NET_API_KEY=<MY_AUTH_TOKEN> --list` to get inventory for
all hosts in Packet.net in all projects (defaults to `--list`
if no argument provided).

`PACKET_NET_API_KEY=<MY_AUTH_TOKEN> --host HOST` to get variables
for a single host.

* improvements in Packet host dynamic inventory
8 years ago
Matt Clay e401b4e424 PEP 8 fix. 8 years ago
Naoya Nakazawa 31db1bcd34 ec2.py support region auto (#15427) 8 years ago
Will Thames d6ea400efb Improve boto profile handling for EC2 inventory (#20280)
Ensure command line profile argument and AWS_PROFILE environment variable
overrides config file
Remove unnecessary `lambda` function
Fix cache file path construction to be more pythonic (and windows-ready)
8 years ago
Matt Clay f80224f828 PEP 8 E111 cleanup. 8 years ago
Matt Clay cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 8 years ago
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 e2c0b375d3 PEP 8 cleanup. (#20790)
* PEP 8 E115 cleanup.
* PEP 8 E131 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
Matt Clay d913f69ba1 PEP 8 W291 whitespace cleanup. 8 years ago
Matt Clay 95789f3949 PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup.
* PEP 8 W293 whitespace cleanup.
* Fix whitespace issue from recent PR.
8 years ago
Matt Clay 63b1e0c277 Fix infrequent PEP 8 issues. 8 years ago
Peter Hoffmann d70b2c8afd fix typo 8 years ago
Matthew Wedgwood 3ab388f6dd Add account ID grouping and attribute to ease multi-account management 8 years ago
Laurent Mazuel 8b9ded3556 Fix bug 17934 : Azure register failure must not be blocking (#18695)
* Fix bug 17934

* Update link in Azure provider warning log
8 years ago
Loïc Blot a3321d1074 vmware_inventory.py: skip_keys can use a full key path (#20389)
use inkey attribute in _process_object_types recursive loop to generate key name in skip_keys directive.

This permit to ignore nested variables, for example summary.vm to optimize inventory collect
8 years ago
Hugh Ma 541d2e8820 Stacki inventory (#19608)
* adding inventory script for stacki

* clean-up for consistency and error check

* clean up imports and implement StrictVersion for requests
8 years ago
Loïc Blot 35f6fb1383 vmware_inventory: permit to group by custom field & customize skip_keys (#20125)
* vmware_inventory: permit to group by custom field

This permits to create instances, affect some custom fields like EC2 tags and then retrieve groups from custom fields like EC2 inventory

* vmware_inventory: Customize skip_keys & add resourceconfig to skip_keys

Verify if customfield is a str before processing custom fields for a host
8 years ago
TaoBeier 6ec0369c26 fix indent (#20071) 8 years ago
Ner'zhul 78ed9793fe Various VMWare inventory (pyvomi fixes) + ini doc (#19926)
* Fix many points reported by PyCharm as PEP 8 code style
* Improve inventory performance by dropping vim.HostSystem & vim.VirtualMachine collect when depth >= 2
* Declare some class variables properly
* Remove some unused variables
* Add documentation in vmware_inventory.ini for VMWARE_USERNAME & VMWARE_PASSWORD env vars
8 years ago
Art Matsak e4c1eff52e Register host variables for the DigitalOcean dynamic inventory 8 years ago
Andrew Craft 44fb104da3 softlayer inventory include group by tags 8 years ago
Aleksey Shirokih db1c3221a0 fix copy paste error 8 years ago
Andrea Tartaglia 59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
8 years ago
Carlos E. Garcia 0b8011436d minor spelling changes 8 years ago
Toshio Kuratomi 51491c9904 Remove itervalues (not available on py3) 8 years ago
Matt Clay 75c281debc Fix compile errors in scripts. 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
Michael Schuett 21813ed83e Fix auth in collins.py inventory
This forces basic auth to be used. Using the normal HTTPPasswordMgrWithDefaultRealm
password manager from urllib2 fails since collins doesn't send a 401 retry on failure.
More about this can be seen here http://stackoverflow.com/questions/2407126/python-urllib2-basic-auth-problem.
I added a small comment about the format of the host so others don't waste time like i did.
8 years ago
Ryan Groten f12d5b01c7 FreeIPA: Add support for nested hostgroups in FreeIPA (#14695) 8 years ago
Dag Wieers 1ca4add91c Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .keys()
http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
8 years ago
Ondra Machacek 563017f7ec Add dynamic inventory for oVirt version 4 and RHV version 4 (#17910)
* Add dynamic inventory for oVirt version 4 and RHV version 4

* Add affinity labels and groups to output
8 years ago
James Tanner 2d2bb626d4 Port has_key to python3 compatible syntax 8 years ago
David Moreau Simard c53db300b8 Update the link to the os-client-config repository
This is a trivial change -- os-client-config has moved from /stackforge/ to /openstack/ a long time ago.
8 years ago
Toshio Kuratomi 03550caece Move mdt dynamic inventory plugin into contrib/inventory where it
belongs
8 years ago
Tony Kinsley 73da2663a3 Resolves #18312 python3 support for ec2.py 8 years ago
Matt Clay 0d46805979 Clean up shebangs for various files.
- Remove shebangs from:
  - ini files
  - unit tests
  - module_utils
  - plugins
  - module_docs_fragments
  - non-executable Makefiles
- Change non-modules from '/usr/bin/python' to '/usr/bin/env python'.
- Change '/bin/env' to '/usr/bin/env'.

Also removed main functions from unit tests (since they no longer
have a shebang) and fixed a python 3 compatibility issue with
update_bundled.py so it does not need to specify a python 2 shebang.

A script was added to check for unexpected shebangs in files.
This script is run during CI on Shippable.
8 years ago
Toshio Kuratomi f7d9a734d5 Port rax dynamic inventory script to Ansible 2.3 get_config() (#18204)
* Port rax dynamic inventory script to Ansible 2.3 get_config()

Fixes #18203
8 years ago
Matt Davis 6b02d296d7 fix azure_rm.py to work with 2.0.0rc5 or rc6 8 years ago
John M. Carlin a3f88eddad Documented configuration option for url 8 years ago
John M. Carlin ef7fd10b15 Add SSL support to Consul inventory script
Change passes in the scheme argument to python-consul's Consul
initializer. Default scheme is set to http.
8 years ago
Thomas Sjögren b35d4d7a19 add tag grouping
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
8 years ago
Thomas Sjögren d24bf49d3f typo, do_tags, do_volume_ids
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
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
René Moser c588bade1f cloudstack: add domain, group per zone to dynamic inventory (#17792) 8 years ago
Daniel Yates 39e86ae2bc Correctly read use_private_network as boolean
This fixes the use of public IPs in the discovered hosts by
ensuring that the use_private_network check doesn't always evaluate
to False if the associated .ini file specifies this option.
8 years ago
Nijin Ashok 1f3d82dd18 Fix improper handling of machine_type in ovirt inventory (#16251)
Currently the machine_type will not work if the instance type is set in ovirt. In that case, inst.get_instance_type will be an object and will fails while converting to json. This only work if the instance type is not set in ovirt where inst.get_instance_type is a Null value. The current change make sure that correct "instance type" is passed when instance is set in ovirt and Null when it's not set in ovirt.
8 years ago
jctanner 05aed6e52e vmware_inventory: fix the --host and add 'properties' feature to ini (#18072)
* vmware_inventory: fix the --host option
* Fix skip_key evaluation
* Short circuit deep dives in datastores and resourcegroups
* Put timestamps in the debug output and add a few more
* Implement a user defined proplist to increase performance
* Make all props into dicts
* Update ini with example
* Fix tests
8 years ago