Commit graph

38 commits

Author SHA1 Message Date
Gonéri Le Bouder
06c7b87613 vmware_inventory: do not ignore validate_certs
Python 2.7.9 < does not have the `ssl.SSLContext` attribute. If
`validate_certs` is `True`, we cannot validate the SSL connection,
and we need to raise an error.
2019-07-26 10:35:12 +02:00
Rowin Andruscavage
896b84bfbe VMware: Python3 migrations for vmware_inventory.py (#47538)
* Sort and pretty print json output and cache file
* Enable Python3 test for vmware_inventory.py

Fixes: #46727

Signed-off-by: Rowin Andruscavage <8740187+MTN-RowinAndruscavage@users.noreply.github.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-06-25 15:40:13 +05:30
Sam Doran
3cd98a9fcc Use ansible.module_utils.six in inventory scripts (#55000)
* Use six from ansible.module_utils for inventory scripts

Remove skips from sanity test

* Change all imports of ConfigParser to use module_utils.six.moves

* Remove commented out lines

* Fix six imports
2019-04-09 13:17:59 -04:00
Abhijeet Kasurde
28284c23a9 VMware: debug property values (#45410)
This fix adds additional information about VM properties

Fixes: #43618

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-04 15:12:48 +00:00
Abhijeet Kasurde
e364d717cb
VMware: remove unused imports (#43804)
Idea taken from https://github.com/ansible/ansible/pull/43402

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-08-09 10:34:55 +05:30
tod-uma
1a0330488f VMware: blacklist custom fields in vmware_inventory.py (#36877)
* Provide the ability to blacklist custom fields from having groups created for them.

* Updated configuration parameter name
2018-07-18 21:39:16 +05:30
smutel
f7dbf581b1 Name of global custom attributes are not managed by the inventory (#41786) 2018-07-05 14:18:20 +05:30
Abhijeet Kasurde
5ed81820c0
VMware: Custom Field in vmware_inventory (#39796)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-05-10 17:38:03 +05:30
Abhijeet Kasurde
12431d23cd VMware: Support for multiple jinja filters in vmware_inventory (#38173)
This fix adds support for multiple jinja filters for groupby_patterns
and host_filters.

Fixes: #37961

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-04-11 15:50:35 -04:00
John Roach
3f2c90914e Fixes Making sure that the key value returns a string to avoid concatenation issues (#37445) 2018-04-05 11:47:55 -04:00
Bill Nottingham
15b6ec66bb Set raw=True when reading passwords from ConfigParser files. (#35582)
* Set `raw=True` when reading passwords from ConfigParser files.

The assumption is that no one is actually doing interpolation on the
password value, even if they may for other configuration values, and
passwords are far more likely to contain '%'.

* Add vmware_inventory as well.
2018-04-05 09:25:11 -04:00
Abhijeet Kasurde
449a0f33e1
Fix ConfigParser.set error in vmware_inventory (#31643)
Fix adds default 'vmware' section in configuration,
when this section is not found.

Fixes: #31549

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-11-28 22:52:59 +05:30
Abhijeet Kasurde
d372cea2f8
VMware: change default host_filter to gueststate (#32839)
This fix changes default value of host_filter in vmware_inventory.py
and vmware_inventory.ini to 'runtime.powerstate' from 'guest.gueststate'.
This change is added as 'guest.gueststate' requires vmware tools to be
installed on given VM, which may not be the case everytime.

Fixes: #25086

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-11-21 04:32:18 +00:00
gamuniz
10866bfb8b Exception handling in vmware_inventory for vcsim (#32700)
* vmware_inventory changes to support vcsim
* updated debug message per maintainer request
2017-11-12 21:29:25 -05:00
jctanner
219a6a67f1 Add a select_chain_match filter to vmware_inventory (#28778) 2017-09-27 19:06:01 -04:00
jctanner
443b25d72a Fixup the property collection for dictionaries vs. objects (#28609)
* Fixup the property collection for dictionaries vs. objects

* Remove debug lines

* Do not attempt to sort because it's a waste

* Remove unused code

* Remove extra code

* Capture lowercase keys
2017-08-25 09:53:01 -04:00
jctanner
65feaa11b2 Fix valueerror in vmware_inventory.py (#28597) 2017-08-24 10:04:52 -04:00
Andrea Tartaglia
fd01a9bb99 Added GPL header to vmware_inventory.py (#24443) 2017-08-18 15:23:45 -04:00
Toshio Kuratomi
225fa5d092 Fix undefined variables, basestring usage, and some associated python3 issues 2017-07-25 15:58:23 -07:00
Abhijeet Kasurde
f7c8e7bdab Update vmware_inventory (#26308)
Fix adds
* Exception handling
* Unit tests

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-18 07:20:23 -04:00
Dag Wieers
758cfeb73e contrib: PEP8 compliancy (#24680)
- Make PEP8 compliant
2017-05-30 21:08:09 +01:00
rafstef
25019fe70c Fix vmware property filter (#23228)
Fixes errors on properties that do not exist.
2017-04-03 15:22:58 -04:00
jctanner
447bb2b150 Add a custom regex_match filter to the vmware_inventory script (#21488) 2017-03-17 21:25:00 -04:00
Roman Belyakovsky
aa6585942e Fix for crash on missing privileges, closes #21051 (#21518) 2017-02-21 08:53:40 -05:00
Loïc Blot
d144cf9c27 vmware_inventory: permit to skip nopermission error on host subkeys (notify user in debug mode) (#21663)
example use case: you have rights on guest but you cannot see the VMWare host

Signed-off-by: nerzhul <loic.blot@unix-experience.fr>
2017-02-21 08:51:23 -05:00
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.
2017-01-28 00:12:11 -08:00
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
2017-01-18 13:36:11 +00:00
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
2017-01-12 09:37:18 -05:00
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
2017-01-10 09:09:11 -05:00
Andrea Tartaglia
59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
2016-12-14 08:01:45 -08:00
Carlos E. Garcia
0b8011436d minor spelling changes 2016-12-13 13:51:13 -05:00
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
2016-10-18 16:21:37 -04:00
jctanner
8095c3951a vmware_inventory: Make the ceritifate check default, and create a config option (#17830)
Fixes #17811
2016-09-30 09:06:02 -04:00
jctanner
66426dcd38 vmware_inventory: decode strings to ascii if not alphanumeric (#17618)
Fixes #17281
2016-09-16 17:09:42 -04:00
jctanner
a0a2e1509e vmware_inventory script improvements (#17142)
* vmware_inventory script improvements
* switch instance finding method to use containerview based searches
* overhaul the serialization method for objects
* Cleanup the debug outputs
* Add a warning about performance
2016-08-19 10:40:22 -04:00
jctanner
072c4bed1d vmware_inventory.py excude more properties and fix debug printing on unicode (#16769)
* Fix broken indentation in vmware inventory
* Allow script to be a symlink without breaking ini path.
* Add some more properties to the bad_types list
* Encode unicode strings to ascii Fixes #16763
2016-07-20 09:46:50 -04:00
jctanner
aa5c8ed86c * Fix broken indentation in vmware inventory (#16177)
* Allow script to be a symlink without breaking ini path.
2016-06-07 18:10:57 -04:00
jctanner
018d3c3118 Add a new vmware inventory script backed by pyvmomi (#15967)
Add a new dynamic vmware inventory script backed by pyvmomi
2016-05-30 20:41:48 -04:00