diff options
| -rw-r--r-- | openstack/common/cfg.py | 2 | ||||
| -rw-r--r-- | tests/unit/test_cfg.py | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py index 66f9185..a9ac004 100644 --- a/openstack/common/cfg.py +++ b/openstack/common/cfg.py @@ -430,7 +430,7 @@ class Opt(object): :param cparser: a ConfigParser object :param section: a section name """ - return cparser.get(section, self.dest) + return cparser.get(section, self.dest, raw=True) def _add_to_cli(self, parser, group=None): """Makes the option available in the command line interface. diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py index c93f444..8dd6352 100644 --- a/tests/unit/test_cfg.py +++ b/tests/unit/test_cfg.py @@ -469,6 +469,18 @@ class ConfigFileOptsTestCase(BaseTestCase): self.assertTrue(hasattr(self.conf, 'bar')) self.assertEquals(self.conf.bar, 'foo') + def test_conf_file_raw_value(self): + self.conf.register_opt(StrOpt('foo')) + + paths = self.create_tempfiles([('test.conf', + '[DEFAULT]\n' + 'foo = bar-%08x\n')]) + + self.conf(['--config-file', paths[0]]) + + self.assertTrue(hasattr(self.conf, 'foo')) + self.assertEquals(self.conf.foo, 'bar-%08x') + class OptGroupsTestCase(BaseTestCase): |
