Merge "Fix quoting for devstack_localrc arguments" into stable/queens

This commit is contained in:
Zuul
2019-10-23 07:41:00 +00:00
committed by Gerrit Code Review
2 changed files with 25 additions and 3 deletions

View File

@@ -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':

View File

@@ -185,7 +185,25 @@ class TestDevstackLocalConf(unittest.TestCase):
for line in f:
if line.startswith('LIBS_FROM_GIT'):
lfg = line.strip().split('=')[1]
self.assertEqual('oslo.db', lfg)
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"
@@ -265,7 +283,7 @@ class TestDevstackLocalConf(unittest.TestCase):
lc.write(p['path'])
tp = self._find_tempest_plugins_value(p['path'])
self.assertEqual('someplugin', tp)
self.assertEqual('"someplugin"', tp)
self.assertEqual(len(lc.warnings), 1)