diff options
author | Ryan Kraus <rmkraus@users.noreply.github.com> | 2019-06-21 12:05:45 -0400 |
---|---|---|
committer | Sam Doran <sdoran@redhat.com> | 2019-06-21 12:05:45 -0400 |
commit | 7d4e3af11ea423aef183cf5e43c8032a7029e097 (patch) | |
tree | 913cf31dc8f7b6046f947ecf3735996c5d813e4a /contrib | |
parent | b86c7759c59aa89134d360d6e86a5f0134347c9d (diff) | |
download | ansible-7d4e3af11ea423aef183cf5e43c8032a7029e097.tar.gz |
Add Python 3 support to ovirt4 inventory script. (#57824)
Python 3 only allows strings through the config parser. This is fine for
the URL, Username, and Password since these values are required. The CA
File is optional so an empty string is used in leiu of None in the
config dictionary.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/inventory/ovirt4.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/inventory/ovirt4.py b/contrib/inventory/ovirt4.py index 69c3cc3a05..74205ae449 100755 --- a/contrib/inventory/ovirt4.py +++ b/contrib/inventory/ovirt4.py @@ -121,7 +121,7 @@ def create_connection(): 'ovirt_url': os.environ.get('OVIRT_URL'), 'ovirt_username': os.environ.get('OVIRT_USERNAME'), 'ovirt_password': os.environ.get('OVIRT_PASSWORD'), - 'ovirt_ca_file': os.environ.get('OVIRT_CAFILE'), + 'ovirt_ca_file': os.environ.get('OVIRT_CAFILE', ''), } ) if not config.has_section('ovirt'): @@ -133,8 +133,8 @@ def create_connection(): url=config.get('ovirt', 'ovirt_url'), username=config.get('ovirt', 'ovirt_username'), password=config.get('ovirt', 'ovirt_password', raw=True), - ca_file=config.get('ovirt', 'ovirt_ca_file'), - insecure=config.get('ovirt', 'ovirt_ca_file') is None, + ca_file=config.get('ovirt', 'ovirt_ca_file') or None, + insecure=not config.get('ovirt', 'ovirt_ca_file'), ) |