Quote devstack_localrc arguments

If you have

 devstack_localrc:
   ARGUMENT: "argument with spaces"

The quotes get lost during YAML processing and the resulting file has

  ARGUMENT=argument with spaces

which is a shell error.

Quote all arguments to avoid this sort of thing.

Change-Id: Ia63a53d745dfea7262bcdb5d46425f431c3ccfe5
This commit is contained in:
Ian Wienand 2019-02-11 12:26:03 +11:00 committed by Clark Boylan
parent 8bdbf85096
commit e769348882
2 changed files with 3 additions and 3 deletions

View File

@ -252,7 +252,7 @@ class LocalConf(object):
if localrc: if localrc:
vg = VarGraph(localrc) vg = VarGraph(localrc)
for k, v in vg.getVars(): for k, v in vg.getVars():
self.localrc.append('{}={}'.format(k, v)) self.localrc.append('{}="{}"'.format(k, v))
if k == 'LIBS_FROM_GIT': if k == 'LIBS_FROM_GIT':
lfg = True lfg = True
elif k == 'TEMPEST_PLUGINS': elif k == 'TEMPEST_PLUGINS':

View File

@ -185,7 +185,7 @@ class TestDevstackLocalConf(unittest.TestCase):
for line in f: for line in f:
if line.startswith('LIBS_FROM_GIT'): if line.startswith('LIBS_FROM_GIT'):
lfg = line.strip().split('=')[1] lfg = line.strip().split('=')[1]
self.assertEqual('oslo.db', lfg) self.assertEqual('"oslo.db"', lfg)
def test_plugin_circular_deps(self): def test_plugin_circular_deps(self):
"Test that plugins with circular dependencies fail" "Test that plugins with circular dependencies fail"
@ -265,7 +265,7 @@ class TestDevstackLocalConf(unittest.TestCase):
lc.write(p['path']) lc.write(p['path'])
tp = self._find_tempest_plugins_value(p['path']) tp = self._find_tempest_plugins_value(p['path'])
self.assertEqual('someplugin', tp) self.assertEqual('"someplugin"', tp)
self.assertEqual(len(lc.warnings), 1) self.assertEqual(len(lc.warnings), 1)