Add strict False param for Config parser

Py3 RawConfigParser does not allow options duplication.

Change-Id: I251fe9c2028fed2f55dee0ef92a3cda89da8a9f6
This commit is contained in:
Andrii Ostapenko 2019-09-27 15:26:52 -05:00
parent 24f9b2322a
commit 3468ae43c9
2 changed files with 6 additions and 2 deletions

View File

@ -25,8 +25,10 @@ import os
import sys import sys
try: try:
import ConfigParser import ConfigParser
PARSER_OPTS = {}
except ImportError: except ImportError:
import configparser as ConfigParser import configparser as ConfigParser
PARSER_OPTS = {"strict": False}
import logging import logging
from sqlalchemy import create_engine from sqlalchemy import create_engine
@ -64,7 +66,7 @@ if "OPENSTACK_CONFIG_FILE" in os.environ:
logger.critical('environment variable OPENSTACK_CONFIG_DB_KEY not set') logger.critical('environment variable OPENSTACK_CONFIG_DB_KEY not set')
sys.exit(1) sys.exit(1)
try: try:
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser(**PARSER_OPTS)
logger.info("Using {0} as db config source".format(os_conf)) logger.info("Using {0} as db config source".format(os_conf))
config.read(os_conf) config.read(os_conf)
logger.info("Trying to load db config from {0}:{1}".format( logger.info("Trying to load db config from {0}:{1}".format(

View File

@ -19,8 +19,10 @@ import os
import sys import sys
try: try:
import ConfigParser import ConfigParser
PARSER_OPTS = {}
except ImportError: except ImportError:
import configparser as ConfigParser import configparser as ConfigParser
PARSER_OPTS = {"strict": False}
import logging import logging
from sqlalchemy import create_engine from sqlalchemy import create_engine
@ -49,7 +51,7 @@ if "OPENSTACK_CONFIG_FILE" in os.environ:
logger.critical('environment variable OPENSTACK_CONFIG_DB_KEY not set') logger.critical('environment variable OPENSTACK_CONFIG_DB_KEY not set')
sys.exit(1) sys.exit(1)
try: try:
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser(**PARSER_OPTS)
logger.info("Using {0} as db config source".format(os_conf)) logger.info("Using {0} as db config source".format(os_conf))
config.read(os_conf) config.read(os_conf)
logger.info("Trying to load db config from {0}:{1}".format( logger.info("Trying to load db config from {0}:{1}".format(