Browse code

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

Ian Wienand authored on 2019/02/11 10:26:03
Showing 2 changed files
... ...
@@ -252,7 +252,7 @@ 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
+                self.localrc.append('{}="{}"'.format(k, v))
256 256
                 if k == 'LIBS_FROM_GIT':
257 257
                     lfg = True
258 258
                 elif k == 'TEMPEST_PLUGINS':
... ...
@@ -185,7 +185,7 @@ class TestDevstackLocalConf(unittest.TestCase):
185 185
             for line in f:
186 186
                 if line.startswith('LIBS_FROM_GIT'):
187 187
                     lfg = line.strip().split('=')[1]
188
-        self.assertEqual('oslo.db', lfg)
188
+        self.assertEqual('"oslo.db"', lfg)
189 189
 
190 190
     def test_plugin_circular_deps(self):
191 191
         "Test that plugins with circular dependencies fail"
... ...
@@ -265,7 +265,7 @@ class TestDevstackLocalConf(unittest.TestCase):
265 265
         lc.write(p['path'])
266 266
 
267 267
         tp = self._find_tempest_plugins_value(p['path'])
268
-        self.assertEqual('someplugin', tp)
268
+        self.assertEqual('"someplugin"', tp)
269 269
         self.assertEqual(len(lc.warnings), 1)
270 270
 
271 271