Merge "Python 3 compatibility: convert ConfigParser to configparser."
This commit is contained in:
commit
92c6e7bfda
@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import re
|
import re
|
||||||
import six
|
import six
|
||||||
from netaddr import (IPNetwork,
|
from netaddr import (IPNetwork,
|
||||||
@ -232,7 +232,7 @@ def lag_mode_to_str(lag_mode):
|
|||||||
def validate_openstack_password(password, rules_file,
|
def validate_openstack_password(password, rules_file,
|
||||||
section="security_compliance"):
|
section="security_compliance"):
|
||||||
try:
|
try:
|
||||||
config = ConfigParser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
parsed_config = config.read(rules_file)
|
parsed_config = config.read(rules_file)
|
||||||
if not parsed_config:
|
if not parsed_config:
|
||||||
msg = ("Cannot parse rules file: %s" % rules_file)
|
msg = ("Cannot parse rules file: %s" % rules_file)
|
||||||
@ -276,7 +276,7 @@ def validate_openstack_password(password, rules_file,
|
|||||||
def extract_openstack_password_rules_from_file(
|
def extract_openstack_password_rules_from_file(
|
||||||
rules_file, section="security_compliance"):
|
rules_file, section="security_compliance"):
|
||||||
try:
|
try:
|
||||||
config = ConfigParser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
parsed_config = config.read(rules_file)
|
parsed_config = config.read(rules_file)
|
||||||
if not parsed_config:
|
if not parsed_config:
|
||||||
msg = ("Cannot parse rules file: %" % rules_file)
|
msg = ("Cannot parse rules file: %" % rules_file)
|
||||||
|
@ -7,7 +7,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
from common.validator import validate
|
from common.validator import validate
|
||||||
from common.configobjects import DEFAULT_CONFIG, REGION_CONFIG
|
from common.configobjects import DEFAULT_CONFIG, REGION_CONFIG
|
||||||
from common.exceptions import ConfigFail, ValidateFail
|
from common.exceptions import ConfigFail, ValidateFail
|
||||||
@ -15,7 +15,7 @@ from common.exceptions import ConfigFail, ValidateFail
|
|||||||
|
|
||||||
def parse_config(config_file):
|
def parse_config(config_file):
|
||||||
"""Parse system config file"""
|
"""Parse system config file"""
|
||||||
config = ConfigParser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
try:
|
try:
|
||||||
config.read(config_file)
|
config.read(config_file)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -93,7 +93,7 @@ def main():
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
offboard = True
|
offboard = True
|
||||||
validate(system_config, config_type, None, offboard)
|
validate(system_config, config_type, None, offboard)
|
||||||
except ConfigParser.Error as e:
|
except configparser.Error as e:
|
||||||
print("Error parsing configuration file %s: %s" % (config_file, e))
|
print("Error parsing configuration file %s: %s" % (config_file, e))
|
||||||
except (ConfigFail, ValidateFail) as e:
|
except (ConfigFail, ValidateFail) as e:
|
||||||
print("\nValidation failed: %s" % e)
|
print("\nValidation failed: %s" % e)
|
||||||
|
@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import wx
|
import wx
|
||||||
import wx.wizard as wiz
|
import wx.wizard as wiz
|
||||||
import wx.lib.dialogs
|
import wx.lib.dialogs
|
||||||
@ -28,7 +28,7 @@ LINK_SPEED_25G = '25000'
|
|||||||
# Config parser to hold current configuration
|
# Config parser to hold current configuration
|
||||||
filename = None
|
filename = None
|
||||||
filedir = None
|
filedir = None
|
||||||
config = ConfigParser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
config.optionxform = str
|
config.optionxform = str
|
||||||
|
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ class STARTPage(WizardPage):
|
|||||||
filedir = reader.GetDirectory()
|
filedir = reader.GetDirectory()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
wx.LogError("Cannot parse configuration file, Error: %s." % ex)
|
wx.LogError("Cannot parse configuration file, Error: %s." % ex)
|
||||||
config = ConfigParser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
config.optionxform = str
|
config.optionxform = str
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import datetime
|
import datetime
|
||||||
import errno
|
import errno
|
||||||
import getpass
|
import getpass
|
||||||
@ -2346,7 +2346,7 @@ class ConfigAssistant():
|
|||||||
print "Specified answer or config file not found"
|
print "Specified answer or config file not found"
|
||||||
raise ConfigFail("Answer or Config file not found")
|
raise ConfigFail("Answer or Config file not found")
|
||||||
|
|
||||||
config = ConfigParser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
config_sections = []
|
config_sections = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@ -553,7 +553,7 @@ def configure_region(config_file, config_type=REGION_CONFIG):
|
|||||||
create_cgcs_config_file(None, region_config, None, None, None,
|
create_cgcs_config_file(None, region_config, None, None, None,
|
||||||
config_type=config_type,
|
config_type=config_type,
|
||||||
validate_only=True)
|
validate_only=True)
|
||||||
except ConfigParser.Error as e:
|
except configparser.Error as e:
|
||||||
raise ConfigFail("Error parsing configuration file %s: %s" %
|
raise ConfigFail("Error parsing configuration file %s: %s" %
|
||||||
(config_file, e))
|
(config_file, e))
|
||||||
print "DONE"
|
print "DONE"
|
||||||
@ -679,7 +679,7 @@ def configure_region(config_file, config_type=REGION_CONFIG):
|
|||||||
create_cgcs_config_file(TEMP_CGCS_CONFIG_FILE, region_config,
|
create_cgcs_config_file(TEMP_CGCS_CONFIG_FILE, region_config,
|
||||||
services, endpoints, domains,
|
services, endpoints, domains,
|
||||||
config_type=config_type)
|
config_type=config_type)
|
||||||
except ConfigParser.Error as e:
|
except configparser.Error as e:
|
||||||
raise ConfigFail("Error parsing configuration file %s: %s" %
|
raise ConfigFail("Error parsing configuration file %s: %s" %
|
||||||
(config_file, e))
|
(config_file, e))
|
||||||
print "DONE"
|
print "DONE"
|
||||||
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import os
|
import os
|
||||||
import readline
|
import readline
|
||||||
import sys
|
import sys
|
||||||
@ -31,7 +31,7 @@ LOG = log.get_logger(__name__)
|
|||||||
|
|
||||||
def parse_system_config(config_file):
|
def parse_system_config(config_file):
|
||||||
"""Parse system config file"""
|
"""Parse system config file"""
|
||||||
system_config = ConfigParser.RawConfigParser()
|
system_config = configparser.RawConfigParser()
|
||||||
try:
|
try:
|
||||||
system_config.read(config_file)
|
system_config.read(config_file)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -145,7 +145,7 @@ def create_cgcs_config_file(output_file, system_config,
|
|||||||
"""
|
"""
|
||||||
cgcs_config = None
|
cgcs_config = None
|
||||||
if not validate_only:
|
if not validate_only:
|
||||||
cgcs_config = ConfigParser.RawConfigParser()
|
cgcs_config = configparser.RawConfigParser()
|
||||||
cgcs_config.optionxform = str
|
cgcs_config.optionxform = str
|
||||||
|
|
||||||
# general error checking, if not validate_only cgcs config data is returned
|
# general error checking, if not validate_only cgcs config data is returned
|
||||||
@ -258,7 +258,7 @@ def configure_system(config_file):
|
|||||||
try:
|
try:
|
||||||
create_cgcs_config_file(None, system_config, None, None, None,
|
create_cgcs_config_file(None, system_config, None, None, None,
|
||||||
DEFAULT_CONFIG, validate_only=True)
|
DEFAULT_CONFIG, validate_only=True)
|
||||||
except ConfigParser.Error as e:
|
except configparser.Error as e:
|
||||||
raise ConfigFail("Error parsing configuration file %s: %s" %
|
raise ConfigFail("Error parsing configuration file %s: %s" %
|
||||||
(config_file, e))
|
(config_file, e))
|
||||||
print "DONE"
|
print "DONE"
|
||||||
@ -268,7 +268,7 @@ def configure_system(config_file):
|
|||||||
try:
|
try:
|
||||||
create_cgcs_config_file(TEMP_CGCS_CONFIG_FILE, system_config,
|
create_cgcs_config_file(TEMP_CGCS_CONFIG_FILE, system_config,
|
||||||
None, None, None, DEFAULT_CONFIG)
|
None, None, None, DEFAULT_CONFIG)
|
||||||
except ConfigParser.Error as e:
|
except configparser.Error as e:
|
||||||
raise ConfigFail("Error parsing configuration file %s: %s" %
|
raise ConfigFail("Error parsing configuration file %s: %s" %
|
||||||
(config_file, e))
|
(config_file, e))
|
||||||
print "DONE"
|
print "DONE"
|
||||||
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import difflib
|
import difflib
|
||||||
import filecmp
|
import filecmp
|
||||||
import fileinput
|
import fileinput
|
||||||
@ -654,10 +654,10 @@ def test_region_config_validation():
|
|||||||
validate(region_config, REGION_CONFIG, None, False)
|
validate(region_config, REGION_CONFIG, None, False)
|
||||||
|
|
||||||
region_config.remove_option('REGION2_PXEBOOT_NETWORK', 'PXEBOOT_CIDR')
|
region_config.remove_option('REGION2_PXEBOOT_NETWORK', 'PXEBOOT_CIDR')
|
||||||
with pytest.raises(ConfigParser.NoOptionError):
|
with pytest.raises(configparser.NoOptionError):
|
||||||
cr.create_cgcs_config_file(None, region_config, None, None, None,
|
cr.create_cgcs_config_file(None, region_config, None, None, None,
|
||||||
validate_only=True)
|
validate_only=True)
|
||||||
with pytest.raises(ConfigParser.NoOptionError):
|
with pytest.raises(configparser.NoOptionError):
|
||||||
validate(region_config, REGION_CONFIG, None, False)
|
validate(region_config, REGION_CONFIG, None, False)
|
||||||
|
|
||||||
# Test overlap of CLM_CIDR
|
# Test overlap of CLM_CIDR
|
||||||
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
@ -200,10 +200,10 @@ def test_system_config_validation():
|
|||||||
validate(system_config, DEFAULT_CONFIG, None, False)
|
validate(system_config, DEFAULT_CONFIG, None, False)
|
||||||
|
|
||||||
system_config.remove_option('PXEBOOT_NETWORK', 'PXEBOOT_CIDR')
|
system_config.remove_option('PXEBOOT_NETWORK', 'PXEBOOT_CIDR')
|
||||||
with pytest.raises(ConfigParser.NoOptionError):
|
with pytest.raises(configparser.NoOptionError):
|
||||||
cr.create_cgcs_config_file(None, system_config, None, None, None, 0,
|
cr.create_cgcs_config_file(None, system_config, None, None, None, 0,
|
||||||
validate_only=True)
|
validate_only=True)
|
||||||
with pytest.raises(ConfigParser.NoOptionError):
|
with pytest.raises(configparser.NoOptionError):
|
||||||
validate(system_config, DEFAULT_CONFIG, None, False)
|
validate(system_config, DEFAULT_CONFIG, None, False)
|
||||||
|
|
||||||
# Test overlap of MGMT_NETWORK CIDR
|
# Test overlap of MGMT_NETWORK CIDR
|
||||||
|
@ -11,7 +11,7 @@ import uuid
|
|||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
import subprocess
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
|
|
||||||
import tsconfig.tsconfig as tsconfig
|
import tsconfig.tsconfig as tsconfig
|
||||||
from controllerconfig.common import log
|
from controllerconfig.common import log
|
||||||
@ -26,7 +26,7 @@ LOG = log.get_logger("cloning")
|
|||||||
DEVNULL = open(os.devnull, 'w')
|
DEVNULL = open(os.devnull, 'w')
|
||||||
INI_FILE = os.path.join("/", clone.CLONE_ARCHIVE_DIR, clone.CLONE_ISO_INI)
|
INI_FILE = os.path.join("/", clone.CLONE_ARCHIVE_DIR, clone.CLONE_ISO_INI)
|
||||||
SECTION = "clone_iso"
|
SECTION = "clone_iso"
|
||||||
parser = ConfigParser.SafeConfigParser()
|
parser = configparser.SafeConfigParser()
|
||||||
clone_name = ""
|
clone_name = ""
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ Root wrapper for OpenStack services
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
@ -71,13 +71,13 @@ def main():
|
|||||||
|
|
||||||
# Load configuration
|
# Load configuration
|
||||||
try:
|
try:
|
||||||
rawconfig = ConfigParser.RawConfigParser()
|
rawconfig = configparser.RawConfigParser()
|
||||||
rawconfig.read(configfile)
|
rawconfig.read(configfile)
|
||||||
config = wrapper.RootwrapConfig(rawconfig)
|
config = wrapper.RootwrapConfig(rawconfig)
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
msg = "Incorrect value in %s: %s" % (configfile, exc.message)
|
msg = "Incorrect value in %s: %s" % (configfile, exc.message)
|
||||||
_exit_error(execname, msg, RC_BADCONFIG, log=False)
|
_exit_error(execname, msg, RC_BADCONFIG, log=False)
|
||||||
except ConfigParser.Error:
|
except configparser.Error:
|
||||||
_exit_error(execname, "Incorrect configuration file: %s" % configfile,
|
_exit_error(execname, "Incorrect configuration file: %s" % configfile,
|
||||||
RC_BADCONFIG, log=False)
|
RC_BADCONFIG, log=False)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import os
|
import os
|
||||||
@ -110,7 +110,7 @@ def load_filters(filters_path):
|
|||||||
if not os.path.isdir(filterdir):
|
if not os.path.isdir(filterdir):
|
||||||
continue
|
continue
|
||||||
for filterfile in os.listdir(filterdir):
|
for filterfile in os.listdir(filterdir):
|
||||||
filterconfig = ConfigParser.RawConfigParser()
|
filterconfig = configparser.RawConfigParser()
|
||||||
filterconfig.read(os.path.join(filterdir, filterfile))
|
filterconfig.read(os.path.join(filterdir, filterfile))
|
||||||
for (name, value) in filterconfig.items("Filters"):
|
for (name, value) in filterconfig.items("Filters"):
|
||||||
filterdefinition = [string.strip(s) for s in value.split(',')]
|
filterdefinition = [string.strip(s) for s in value.split(',')]
|
||||||
|
@ -41,7 +41,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import StringIO
|
import StringIO
|
||||||
import socket
|
import socket
|
||||||
import yaml
|
import yaml
|
||||||
@ -344,7 +344,7 @@ class AgentManager(service.PeriodicService):
|
|||||||
ini_str = '[DEFAULT]\n' + open(CONFIG_APPLIED_FILE, 'r').read()
|
ini_str = '[DEFAULT]\n' + open(CONFIG_APPLIED_FILE, 'r').read()
|
||||||
ini_fp = StringIO.StringIO(ini_str)
|
ini_fp = StringIO.StringIO(ini_str)
|
||||||
|
|
||||||
config_applied = ConfigParser.RawConfigParser()
|
config_applied = configparser.RawConfigParser()
|
||||||
config_applied.optionxform = str
|
config_applied.optionxform = str
|
||||||
config_applied.readfp(ini_fp)
|
config_applied.readfp(ini_fp)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ It also allows setting of formatting information through conf.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import inspect
|
import inspect
|
||||||
import itertools
|
import itertools
|
||||||
@ -347,7 +347,7 @@ class LogConfigError(Exception):
|
|||||||
def _load_log_config(log_config):
|
def _load_log_config(log_config):
|
||||||
try:
|
try:
|
||||||
logging.config.fileConfig(log_config)
|
logging.config.fileConfig(log_config)
|
||||||
except ConfigParser.Error as exc:
|
except configparser.Error as exc:
|
||||||
raise LogConfigError(log_config, str(exc))
|
raise LogConfigError(log_config, str(exc))
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
@ -82,13 +82,13 @@ def main():
|
|||||||
|
|
||||||
# Load configuration
|
# Load configuration
|
||||||
try:
|
try:
|
||||||
rawconfig = ConfigParser.RawConfigParser()
|
rawconfig = configparser.RawConfigParser()
|
||||||
rawconfig.read(configfile)
|
rawconfig.read(configfile)
|
||||||
config = wrapper.RootwrapConfig(rawconfig)
|
config = wrapper.RootwrapConfig(rawconfig)
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
msg = "Incorrect value in %s: %s" % (configfile, exc.message)
|
msg = "Incorrect value in %s: %s" % (configfile, exc.message)
|
||||||
_exit_error(execname, msg, RC_BADCONFIG, log=False)
|
_exit_error(execname, msg, RC_BADCONFIG, log=False)
|
||||||
except ConfigParser.Error:
|
except configparser.Error:
|
||||||
_exit_error(execname, "Incorrect configuration file: %s" % configfile,
|
_exit_error(execname, "Incorrect configuration file: %s" % configfile,
|
||||||
RC_BADCONFIG, log=False)
|
RC_BADCONFIG, log=False)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import os
|
import os
|
||||||
@ -109,7 +109,7 @@ def load_filters(filters_path):
|
|||||||
if not os.path.isdir(filterdir):
|
if not os.path.isdir(filterdir):
|
||||||
continue
|
continue
|
||||||
for filterfile in os.listdir(filterdir):
|
for filterfile in os.listdir(filterdir):
|
||||||
filterconfig = ConfigParser.RawConfigParser()
|
filterconfig = configparser.RawConfigParser()
|
||||||
filterconfig.read(os.path.join(filterdir, filterfile))
|
filterconfig.read(os.path.join(filterdir, filterfile))
|
||||||
for (name, value) in filterconfig.items("Filters"):
|
for (name, value) in filterconfig.items("Filters"):
|
||||||
filterdefinition = [string.strip(s) for s in value.split(',')]
|
filterdefinition = [string.strip(s) for s in value.split(',')]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from sysinv.common import constants
|
from sysinv.common import constants
|
||||||
@ -377,7 +377,7 @@ class KeystonePuppet(openstack.OpenstackBasePuppet):
|
|||||||
def _extract_openstack_password_rules_from_file(
|
def _extract_openstack_password_rules_from_file(
|
||||||
rules_file, section="security_compliance"):
|
rules_file, section="security_compliance"):
|
||||||
try:
|
try:
|
||||||
config = ConfigParser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
parsed_config = config.read(rules_file)
|
parsed_config = config.read(rules_file)
|
||||||
if not parsed_config:
|
if not parsed_config:
|
||||||
msg = ("Cannot parse rules file: %s" % rules_file)
|
msg = ("Cannot parse rules file: %s" % rules_file)
|
||||||
|
@ -42,7 +42,7 @@ postgres=# create database openstack_citest with owner openstack_citest;
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import commands
|
import commands
|
||||||
import ConfigParser
|
from six.moves import configparser
|
||||||
import os
|
import os
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
@ -171,13 +171,13 @@ class BaseMigrationTestCase(test_utils.BaseTestCase):
|
|||||||
# once. No need to re-run this on each test...
|
# once. No need to re-run this on each test...
|
||||||
LOG.debug('config_path is %s' % self.CONFIG_FILE_PATH)
|
LOG.debug('config_path is %s' % self.CONFIG_FILE_PATH)
|
||||||
if os.path.exists(self.CONFIG_FILE_PATH):
|
if os.path.exists(self.CONFIG_FILE_PATH):
|
||||||
cp = ConfigParser.RawConfigParser()
|
cp = configparser.RawConfigParser()
|
||||||
try:
|
try:
|
||||||
cp.read(self.CONFIG_FILE_PATH)
|
cp.read(self.CONFIG_FILE_PATH)
|
||||||
defaults = cp.defaults()
|
defaults = cp.defaults()
|
||||||
for key, value in defaults.items():
|
for key, value in defaults.items():
|
||||||
self.test_databases[key] = value
|
self.test_databases[key] = value
|
||||||
except ConfigParser.ParsingError as e:
|
except configparser.ParsingError as e:
|
||||||
self.fail("Failed to read test_migrations.conf config "
|
self.fail("Failed to read test_migrations.conf config "
|
||||||
"file. Got error: %s" % e)
|
"file. Got error: %s" % e)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user