ovirt: dyn_inventory fix Python2 and Python3 compat (#22453)

pull/22495/head
Ondra Machacek 8 years ago committed by jctanner
parent 990aa73ed8
commit 0433be33bd

@ -60,12 +60,16 @@ Author: Ondra Machacek (@machacekondra)
""" """
import argparse import argparse
import ConfigParser
import os import os
import sys import sys
from collections import defaultdict from collections import defaultdict
try:
import ConfigParser as configparser
except ImportError:
import configparser
try: try:
import json import json
except ImportError: except ImportError:
@ -118,7 +122,7 @@ def create_connection():
config_path = os.environ.get('OVIRT_INI_PATH', default_path) config_path = os.environ.get('OVIRT_INI_PATH', default_path)
# Create parser and add ovirt section if it doesn't exist: # Create parser and add ovirt section if it doesn't exist:
config = ConfigParser.SafeConfigParser( config = configparser.SafeConfigParser(
defaults={ defaults={
'ovirt_url': None, 'ovirt_url': None,
'ovirt_username': None, 'ovirt_username': None,
@ -135,8 +139,8 @@ def create_connection():
url=config.get('ovirt', 'ovirt_url'), url=config.get('ovirt', 'ovirt_url'),
username=config.get('ovirt', 'ovirt_username'), username=config.get('ovirt', 'ovirt_username'),
password=config.get('ovirt', 'ovirt_password'), password=config.get('ovirt', 'ovirt_password'),
ca_file=config.get('ovirt', 'ovirt_ca_file', None), ca_file=config.get('ovirt', 'ovirt_ca_file'),
insecure=config.get('ovirt', 'ovirt_ca_file', None) is None, insecure=config.get('ovirt', 'ovirt_ca_file') is None,
) )

Loading…
Cancel
Save