summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorThierry Carrez <thierry@openstack.org>2012-01-23 11:17:34 +0100
committerThierry Carrez <thierry@openstack.org>2012-01-23 13:59:42 +0100
commitbfdb9b1f5e197a0d2f76f7d32835c521e5b30d6f (patch)
tree314616f0d32576bf076d2c4d950cbf8ef682b111 /nova/tests
parente3451ac3098adf64480d07d4c29ecf7412afb88c (diff)
Fix environment passing in DnsmasqFilter
Fix environment passing in DnsmasqFilter so that dnsmasq can be run as root through nova-rootwrap. Fixes bug 919275. Change-Id: I2e78d92b9af4ddea9c0f1c5ddbe2d55fb672310e
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_nova_rootwrap.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/nova/tests/test_nova_rootwrap.py b/nova/tests/test_nova_rootwrap.py
index c9a6962ba..a38013016 100644
--- a/nova/tests/test_nova_rootwrap.py
+++ b/nova/tests/test_nova_rootwrap.py
@@ -52,11 +52,13 @@ class RootwrapTestCase(test.TestCase):
self.assertTrue(filtermatch is None)
def test_DnsmasqFilter(self):
- usercmd = ['FLAGFILE=A', 'NETWORK_ID="foo bar"', 'dnsmasq', 'foo']
+ usercmd = ['FLAGFILE=A', 'NETWORK_ID=foobar', 'dnsmasq', 'foo']
f = filters.DnsmasqFilter("/usr/bin/dnsmasq", "root")
self.assertTrue(f.match(usercmd))
- self.assertEqual(f.get_command(usercmd),
- ['FLAGFILE=A', 'NETWORK_ID="foo bar"', '/usr/bin/dnsmasq', 'foo'])
+ self.assertEqual(f.get_command(usercmd), ['/usr/bin/dnsmasq', 'foo'])
+ env = f.get_environment(usercmd)
+ self.assertEqual(env.get('FLAGFILE'), 'A')
+ self.assertEqual(env.get('NETWORK_ID'), 'foobar')
def test_skips(self):
# Check that all filters are skipped and that the last matches