diff --git a/roles/write-devstack-local-conf/library/devstack_local_conf.py b/roles/write-devstack-local-conf/library/devstack_local_conf.py index 3a8cd588b9..2f97d0e355 100644 --- a/roles/write-devstack-local-conf/library/devstack_local_conf.py +++ b/roles/write-devstack-local-conf/library/devstack_local_conf.py @@ -252,7 +252,11 @@ class LocalConf(object): if localrc: vg = VarGraph(localrc) for k, v in vg.getVars(): - self.localrc.append('{}="{}"'.format(k, v)) + # Avoid double quoting + if len(v) and v[0]=='"': + self.localrc.append('{}={}'.format(k, v)) + else: + self.localrc.append('{}="{}"'.format(k, v)) if k == 'LIBS_FROM_GIT': lfg = True elif k == 'TEMPEST_PLUGINS': diff --git a/roles/write-devstack-local-conf/library/test.py b/roles/write-devstack-local-conf/library/test.py index 22bf2da55d..7c526b34c8 100644 --- a/roles/write-devstack-local-conf/library/test.py +++ b/roles/write-devstack-local-conf/library/test.py @@ -187,6 +187,24 @@ class TestDevstackLocalConf(unittest.TestCase): lfg = line.strip().split('=')[1] self.assertEqual('"oslo.db"', lfg) + def test_avoid_double_quote(self): + "Test that there a no duplicated quotes" + localrc = {'TESTVAR': '"quoted value"'} + p = dict(localrc=localrc, + base_services=[], + base_dir='./test', + path=os.path.join(self.tmpdir, 'test.local.conf'), + projects={}) + lc = self._init_localconf(p) + lc.write(p['path']) + + testvar = None + with open(p['path']) as f: + for line in f: + if line.startswith('TESTVAR'): + testvar = line.strip().split('=')[1] + self.assertEqual('"quoted value"', testvar) + def test_plugin_circular_deps(self): "Test that plugins with circular dependencies fail" os.makedirs(os.path.join(self.tmpdir, 'foo-plugin', 'devstack'))