From 4d591f43631435e07dc812314cfa6b165f4c1afd Mon Sep 17 00:00:00 2001 From: Andrii Ostapenko Date: Fri, 27 Sep 2019 13:19:28 -0500 Subject: [PATCH] Add strict False param for Config parser Py3 RawConfigParser does not allow options duplication. Change-Id: I6ab4ebf7cefc7a33171b92bf784a7e5416535c7a --- helm-toolkit/templates/scripts/_db-drop.py.tpl | 4 +++- helm-toolkit/templates/scripts/_db-init.py.tpl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/helm-toolkit/templates/scripts/_db-drop.py.tpl b/helm-toolkit/templates/scripts/_db-drop.py.tpl index 55280c618..074e56e4a 100644 --- a/helm-toolkit/templates/scripts/_db-drop.py.tpl +++ b/helm-toolkit/templates/scripts/_db-drop.py.tpl @@ -29,8 +29,10 @@ import os import sys try: import ConfigParser + PARSER_OPTS = {} except ImportError: import configparser as ConfigParser + PARSER_OPTS = {"strict": False} import logging 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') sys.exit(1) try: - config = ConfigParser.RawConfigParser() + config = ConfigParser.RawConfigParser(**PARSER_OPTS) logger.info("Using {0} as db config source".format(os_conf)) config.read(os_conf) logger.info("Trying to load db config from {0}:{1}".format( diff --git a/helm-toolkit/templates/scripts/_db-init.py.tpl b/helm-toolkit/templates/scripts/_db-init.py.tpl index ca0ff5828..2bd22dfd3 100644 --- a/helm-toolkit/templates/scripts/_db-init.py.tpl +++ b/helm-toolkit/templates/scripts/_db-init.py.tpl @@ -29,8 +29,10 @@ import os import sys try: import ConfigParser + PARSER_OPTS = {} except ImportError: import configparser as ConfigParser + PARSER_OPTS = {"strict": False} import logging 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') sys.exit(1) try: - config = ConfigParser.RawConfigParser() + config = ConfigParser.RawConfigParser(**PARSER_OPTS) logger.info("Using {0} as db config source".format(os_conf)) config.read(os_conf) logger.info("Trying to load db config from {0}:{1}".format(