diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-12-06 12:42:02 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-12-06 12:42:02 +0000 |
| commit | ec7a2ee73ffa86d0a1b9b490798d13dc53d20706 (patch) | |
| tree | 68cd099f2834ea7759288670f489541a8c67b0d3 | |
| parent | 255a27333092be0523949bd624c94b740515d018 (diff) | |
| parent | 7cf016a21558803039cfadd2b98cc5cab528972f (diff) | |
| download | oslo-ec7a2ee73ffa86d0a1b9b490798d13dc53d20706.tar.gz oslo-ec7a2ee73ffa86d0a1b9b490798d13dc53d20706.tar.xz oslo-ec7a2ee73ffa86d0a1b9b490798d13dc53d20706.zip | |
Merge "Fixing the trim for ListOp when reading from config file"
| -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'])) |
