summaryrefslogtreecommitdiff
path: root/tests/test_cfg.py
diff options
context:
space:
mode:
authorZhongyue Luo <zhongyue.nah@intel.com>2013-09-11 13:11:17 +0800
committerZhongyue Luo <zhongyue.nah@intel.com>2013-09-17 21:44:44 +0800
commitf2be4e83f04579ee0cd87e8601868f310c951fac (patch)
treeb36bdb27f9fe8eacae1eb14a9efb37d02ee47494 /tests/test_cfg.py
parent0b915fd91f40c968aa507ba3c90ae43071646a5f (diff)
downloadoslo-config-f2be4e83f04579ee0cd87e8601868f310c951fac.tar.gz
Fix DictOpt to split only the first colon
I've encountered a ValueError when adapting DictOpt to neutron's network_vlan_ranges. https://github.com/openstack/neutron/blob/master/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini#L23 This patch makes dictopt to split only the first colon for every value Fixes bug #1223667 Change-Id: Iee4011f2a45be933dad393c72df099d6a8116849
Diffstat (limited to 'tests/test_cfg.py')
-rw-r--r--tests/test_cfg.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_cfg.py b/tests/test_cfg.py
index c237453..8d939ca 100644
--- a/tests/test_cfg.py
+++ b/tests/test_cfg.py
@@ -1010,6 +1010,18 @@ class ConfigFileOptsTestCase(BaseTestCase):
self.assertTrue(hasattr(self.conf, 'foo'))
self.assertEqual(self.conf.foo, {'key': 'bar'})
+ def test_conf_file_dict_colon_in_value(self):
+ self.conf.register_opt(cfg.DictOpt('foo'))
+
+ paths = self.create_tempfiles([('test',
+ '[DEFAULT]\n'
+ 'foo = key:bar:baz\n')])
+
+ self.conf(['--config-file', paths[0]])
+
+ self.assertTrue(hasattr(self.conf, 'foo'))
+ self.assertEqual(self.conf.foo, {'key': 'bar:baz'})
+
def test_conf_file_dict_values_override_deprecated(self):
self.conf.register_cli_opt(cfg.DictOpt('foo',
deprecated_name='oldfoo'))