summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2016-03-18 11:02:14 -0700
committerToshio Kuratomi <a.badger@gmail.com>2016-03-18 11:02:14 -0700
commit959711b56e0b5e4bd4ba42f01c2f93d02f68a7d4 (patch)
tree7bf0be139d7b725fa15a1b20218dad9ebb2f17e6
parentb95286c88e3e8636ecd697cc41b55dcf7fbeb026 (diff)
parent421fb6df8be10f3adaa4457e6915fded21cb76a2 (diff)
downloadansible-959711b56e0b5e4bd4ba42f01c2f93d02f68a7d4.tar.gz
Merge pull request #14993 from karmab/ovirt_connection_fix
Fixes ovirt inventory to only override credentials when keys exist
-rwxr-xr-xcontrib/inventory/ovirt.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/inventory/ovirt.py b/contrib/inventory/ovirt.py
index 23646fa206..dccbf42127 100755
--- a/contrib/inventory/ovirt.py
+++ b/contrib/inventory/ovirt.py
@@ -172,9 +172,9 @@ class OVirtInventory(object):
# If the appropriate environment variables are set, they override
# other configuration; process those into our args and kwargs.
- kwargs['url'] = os.environ.get('OVIRT_URL')
- kwargs['username'] = os.environ.get('OVIRT_EMAIL')
- kwargs['password'] = os.environ.get('OVIRT_PASS')
+ kwargs['url'] = os.environ.get('OVIRT_URL', kwargs['url'])
+ kwargs['username'] = next(val for val in [os.environ.get('OVIRT_EMAIL'), os.environ.get('OVIRT_USERNAME'), kwargs['username']] if val is not None)
+ kwargs['password'] = next(val for val in [os.environ.get('OVIRT_PASS'), os.environ.get('OVIRT_PASSWORD'), kwargs['password']] if val is not None)
# Retrieve and return the ovirt driver.
return API(insecure=True, **kwargs)