Deal with CONF.config_dir correctly

When config_dir is set, we were seeing this error:
  execv() arg 2 must contain only strings

We got this debug log:
  ['sudo', 'nova-rootwrap', ... ,
  '--config-file', '/nova/nova.conf', '--config-dir', ['/etc/nova'],
  ...]

Change-Id: I592035f7e37adee375f1530d4fbc28107870b089
Closes-Bug: 1616240
(cherry picked from commit 1666d9153a)
This commit is contained in:
John Garbutt 2016-08-26 13:00:05 +01:00 committed by Matt Riedemann
parent d186635525
commit 928b08f112
2 changed files with 3 additions and 2 deletions

View File

@ -158,7 +158,8 @@ class PrivContext(object):
try:
if cfg.CONF.config_dir is not None:
cmd.extend(['--config-dir', cfg.CONF.config_dir])
for cfg_dir in cfg.CONF.config_dir:
cmd.extend(['--config-dir', cfg_dir])
except cfg.NoSuchOptError:
pass

View File

@ -104,7 +104,7 @@ class PrivContextTest(testctx.TestContextTestCase):
def test_helper_command_default_dirtoo(self):
self.privsep_conf.config_file = ['/bar.conf', '/baz.conf']
self.privsep_conf.config_dir = '/foo.d'
self.privsep_conf.config_dir = ['/foo.d']
cmd = testctx.context.helper_command('/tmp/sockpath')
expected = [
'sudo', 'privsep-helper',