Add strict False param for Config parser

Py3 RawConfigParser does not allow options duplication.

Change-Id: I6ab4ebf7cefc7a33171b92bf784a7e5416535c7a
This commit is contained in:
Andrii Ostapenko 2019-09-27 13:19:28 -05:00
parent 5c97d5bc2a
commit 4d591f4363
2 changed files with 6 additions and 2 deletions

View File

@ -29,8 +29,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
@ -68,7 +70,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

@ -29,8 +29,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
@ -68,7 +70,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(