diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-02-10 17:32:00 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-02-10 17:32:00 +0000 |
| commit | 2ad09351f3c4f69ffcae16815b76eb28cb07a9b7 (patch) | |
| tree | ff2aa55cbd462baa502067273f608d03ddf6ae48 | |
| parent | 763940b4526ab0e5dbdf38bd8d904b56913e7179 (diff) | |
| parent | 8723af7665d004ae088d5066b795877c7d8f890f (diff) | |
| download | oslo-2ad09351f3c4f69ffcae16815b76eb28cb07a9b7.tar.gz oslo-2ad09351f3c4f69ffcae16815b76eb28cb07a9b7.tar.xz oslo-2ad09351f3c4f69ffcae16815b76eb28cb07a9b7.zip | |
Merge "Disable ConfigParser interpolation (lp#930270)"
| -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): |
