diff options
| -rw-r--r-- | openstack/common/cfg.py | 2 | ||||
| -rw-r--r-- | tests/unit/test_cfg.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py index 69f0de8..acef6fb 100644 --- a/openstack/common/cfg.py +++ b/openstack/common/cfg.py @@ -771,7 +771,7 @@ class ListOpt(Opt): def _get_from_config_parser(self, cparser, section): """Retrieve the opt value as a list from ConfigParser.""" - return [v.split(',') for v in + return [[a.strip() for a in v.split(',')] for v in self._cparser_get_with_deprecated(cparser, section)] def _get_argparse_kwargs(self, group, **kwargs): diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py index be64d13..e7d58ec 100644 --- a/tests/unit/test_cfg.py +++ b/tests/unit/test_cfg.py @@ -595,6 +595,12 @@ class ConfigFileOptsTestCase(BaseTestCase): def test_conf_file_list_ignore_deprecated(self): self._do_deprecated_test_ignore(ListOpt, 'd,e,f', ['d', 'e', 'f']) + def test_conf_file_list_spaces_use_deprecated(self): + self._do_deprecated_test_use(ListOpt, 'a, b, c', ['a', 'b', 'c']) + + def test_conf_file_list_spaces_ignore_deprecated(self): + self._do_deprecated_test_ignore(ListOpt, 'd, e, f', ['d', 'e', 'f']) + def test_conf_file_multistr_default(self): self.conf.register_opt(MultiStrOpt('foo', default=['bar'])) |
