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.
This commit is contained in:
Ondra Machacek 2017-10-18 12:26:03 +02:00 committed by John R Barker
parent 4602a4e117
commit a7df2322e4

View file

@ -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'):