From 3468ae43c93be9d7bfebf3f6ab3e2df6b5f9e9b9 Mon Sep 17 00:00:00 2001 From: Andrii Ostapenko Date: Fri, 27 Sep 2019 15:26:52 -0500 Subject: [PATCH] Add strict False param for Config parser Py3 RawConfigParser does not allow options duplication. Change-Id: I251fe9c2028fed2f55dee0ef92a3cda89da8a9f6 --- keystone/templates/bin/_cred-clean.py.tpl | 4 +++- keystone/templates/bin/_endpoint-update.py.tpl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/keystone/templates/bin/_cred-clean.py.tpl b/keystone/templates/bin/_cred-clean.py.tpl index 9d1306a07e..4d2c3f1439 100644 --- a/keystone/templates/bin/_cred-clean.py.tpl +++ b/keystone/templates/bin/_cred-clean.py.tpl @@ -25,8 +25,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 @@ -64,7 +66,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/keystone/templates/bin/_endpoint-update.py.tpl b/keystone/templates/bin/_endpoint-update.py.tpl index 62794f836d..7ea1a5b6d4 100644 --- a/keystone/templates/bin/_endpoint-update.py.tpl +++ b/keystone/templates/bin/_endpoint-update.py.tpl @@ -19,8 +19,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 @@ -49,7 +51,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(