From: Kefu Chai Date: Mon, 6 Apr 2020 08:37:55 +0000 (+0800) Subject: qa/tasks/tempest.py: always write str is value of options X-Git-Tag: v14.2.10~17^2~59 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a01bd93a9603d70aaf399ee43760578faa6df21c;p=ceph.git qa/tasks/tempest.py: always write str is value of options 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 (cherry picked from commit 5ef3a5fe3282146b56bd2a589fef17c28d57e8e2) --- diff --git a/qa/tasks/tempest.py b/qa/tasks/tempest.py index aeee1f0866c9..13189fd54b5e 100644 --- a/qa/tasks/tempest.py +++ b/qa/tasks/tempest.py @@ -92,8 +92,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