From a7df2322e4c4cf077701f7a2c1a48ee06850e9f1 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Wed, 18 Oct 2017 12:26:03 +0200 Subject: [PATCH] ovirt: Add env variables to dynamic inventory (#31821) This patch add new environment variables to oVirt dynamic inventory to be consistent with all other oVirt modules: OVIRT_URL OVIRT_USERNAME OVIRT_CAFILE OVIRT_PASSWORD Those variables are used as fallback if user don't specify a ini file, with appropriate variables there. --- contrib/inventory/ovirt4.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/inventory/ovirt4.py b/contrib/inventory/ovirt4.py index 6221325f34..53499220b9 100755 --- a/contrib/inventory/ovirt4.py +++ b/contrib/inventory/ovirt4.py @@ -124,10 +124,10 @@ def create_connection(): # Create parser and add ovirt section if it doesn't exist: config = configparser.SafeConfigParser( defaults={ - 'ovirt_url': None, - 'ovirt_username': None, - 'ovirt_password': None, - 'ovirt_ca_file': None, + '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'), } ) if not config.has_section('ovirt'):