From 7b5bb0b4369245148b4dd8948a96fdc202dcb0cc Mon Sep 17 00:00:00 2001 From: Xing Zhang Date: Sun, 31 May 2020 11:08:15 +0800 Subject: [PATCH] Make config parser case sensitivity in rally-openstack rally verify start will convert config options to lowercase by using configparser, which cannot set the right config for oslo.config. Options in config file should be case sensitive, some projects like octavia-tempest-plugin can't set some value as expected: [load_balancer] RBAC_test_type = owner_or_admin Use `conf.optionxform = str` to prevent case transformation[1]. [1] https://docs.python.org/3/library/configparser.html Change-Id: I553c962d40ab73e50c1e3f5b229ab553c17fda55 Closes-Bug: #1881456 --- CHANGELOG.rst | 11 +++++++++++ rally_openstack/verification/tempest/config.py | 1 + rally_openstack/verification/tempest/context.py | 1 + tests/functional/utils.py | 1 + 4 files changed, 14 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c20a4dcd..7f2e4cad 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,17 @@ Changelog .. Release notes for existing releases are MUTABLE! If there is something that was missed or can be improved, feel free to change it! +[unreleased] +------------ + +Fixed +~~~~~ + +* [verification component] Make config parser case sensitivity in + TempestContext and TempestConfigfileManager. + + `Launchpad-bug #1881456 `_ + [2.0.0] - 2020-05-08 -------------------- diff --git a/rally_openstack/verification/tempest/config.py b/rally_openstack/verification/tempest/config.py index f4a03eba..58ea35ec 100644 --- a/rally_openstack/verification/tempest/config.py +++ b/rally_openstack/verification/tempest/config.py @@ -49,6 +49,7 @@ class TempestConfigfileManager(object): self.available_services = self.clients.services().values() self.conf = configparser.ConfigParser(allow_no_value=True) + self.conf.optionxform = str def _get_service_type_by_service_name(self, service_name): for s_type, s_name in self.clients.services().items(): diff --git a/rally_openstack/verification/tempest/context.py b/rally_openstack/verification/tempest/context.py index 87481271..efb2ba54 100644 --- a/rally_openstack/verification/tempest/context.py +++ b/rally_openstack/verification/tempest/context.py @@ -53,6 +53,7 @@ class TempestContext(context.VerifierContext): self.available_services = self.clients.services().values() self.conf = configparser.ConfigParser(allow_no_value=True) + self.conf.optionxform = str self.conf_path = self.verifier.manager.configfile self.data_dir = self.verifier.manager.home_dir diff --git a/tests/functional/utils.py b/tests/functional/utils.py index efff9b83..993b3a22 100644 --- a/tests/functional/utils.py +++ b/tests/functional/utils.py @@ -111,6 +111,7 @@ class Rally(object): if self.config_opts: self.config_filename = os.path.join(self.tmp_dir, "conf") config = configparser.RawConfigParser() + config.optionxform = str for section, opts in self.config_opts.items(): if section.lower() != "default": config.add_section(section)