... | ... |
@@ -252,7 +252,11 @@ class LocalConf(object): |
252 | 252 |
if localrc: |
253 | 253 |
vg = VarGraph(localrc) |
254 | 254 |
for k, v in vg.getVars(): |
255 |
- self.localrc.append('{}="{}"'.format(k, v)) |
|
255 |
+ # Avoid double quoting |
|
256 |
+ if len(v) and v[0]=='"': |
|
257 |
+ self.localrc.append('{}={}'.format(k, v)) |
|
258 |
+ else: |
|
259 |
+ self.localrc.append('{}="{}"'.format(k, v)) |
|
256 | 260 |
if k == 'LIBS_FROM_GIT': |
257 | 261 |
lfg = True |
258 | 262 |
elif k == 'TEMPEST_PLUGINS': |
... | ... |
@@ -187,6 +187,24 @@ class TestDevstackLocalConf(unittest.TestCase): |
187 | 187 |
lfg = line.strip().split('=')[1] |
188 | 188 |
self.assertEqual('"oslo.db"', lfg) |
189 | 189 |
|
190 |
+ def test_avoid_double_quote(self): |
|
191 |
+ "Test that there a no duplicated quotes" |
|
192 |
+ localrc = {'TESTVAR': '"quoted value"'} |
|
193 |
+ p = dict(localrc=localrc, |
|
194 |
+ base_services=[], |
|
195 |
+ base_dir='./test', |
|
196 |
+ path=os.path.join(self.tmpdir, 'test.local.conf'), |
|
197 |
+ projects={}) |
|
198 |
+ lc = self._init_localconf(p) |
|
199 |
+ lc.write(p['path']) |
|
200 |
+ |
|
201 |
+ testvar = None |
|
202 |
+ with open(p['path']) as f: |
|
203 |
+ for line in f: |
|
204 |
+ if line.startswith('TESTVAR'): |
|
205 |
+ testvar = line.strip().split('=')[1] |
|
206 |
+ self.assertEqual('"quoted value"', testvar) |
|
207 |
+ |
|
190 | 208 |
def test_plugin_circular_deps(self): |
191 | 209 |
"Test that plugins with circular dependencies fail" |
192 | 210 |
os.makedirs(os.path.join(self.tmpdir, 'foo-plugin', 'devstack')) |