]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/tempest.py: always write str is value of options
authorKefu Chai <kchai@redhat.com>
Mon, 6 Apr 2020 08:37:55 +0000 (16:37 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 7 Apr 2020 13:51:23 +0000 (21:51 +0800)
in Python2, ConfigParser is almost the same as RawConfigParser, which
allows set non-string values, but in Python3, ConfigParser.set() only
accepts strings as value of option.

since we do not use "cpar" as an internal storage for options, it does
not matter what type of options we set using ConfigParser as long as it
can be consumed by tempest. boolean settings are translated to "true" or
"false". see also
https://docs.openstack.org/tempest/latest/sampleconf.html

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/tempest.py

index 5e760dbcbdc1579539830adb8b1c76838c34c028..c75bfbe966b966d233c626c29b305312cbeedbb8 100644 (file)
@@ -101,8 +101,12 @@ def setup_logging(ctx, cpar):
 
 def to_config(config, params, section, cpar):
     for (k, v) in config[section].items():
-        if (isinstance(v, str)):
+        if isinstance(v, str):
             v = v.format(**params)
+        elif isinstance(v, bool):
+            v = 'true' if v else 'false'
+        else:
+            v = str(v)
         cpar.set(section, k, v)
 
 @contextlib.contextmanager