summaryrefslogtreecommitdiffstats
path: root/nova/rootwrap
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/rootwrap
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/rootwrap')
-rwxr-xr-xnova/rootwrap/filters.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/nova/rootwrap/filters.py b/nova/rootwrap/filters.py
index 2932c5e1a..ab43f8f2b 100755
--- a/nova/rootwrap/filters.py
+++ b/nova/rootwrap/filters.py
@@ -41,6 +41,10 @@ class CommandFilter(object):
return ['sudo', '-u', self.run_as, self.exec_path] + userargs[1:]
return [self.exec_path] + userargs[1:]
+ def get_environment(self, userargs):
+ """Returns specific environment to set, None if none"""
+ return None
+
class RegExpFilter(CommandFilter):
"""Command filter doing regexp matching for every argument"""
@@ -77,4 +81,10 @@ class DnsmasqFilter(CommandFilter):
return False
def get_command(self, userargs):
- return userargs[0:2] + [self.exec_path] + userargs[3:]
+ return [self.exec_path] + userargs[3:]
+
+ def get_environment(self, userargs):
+ env = os.environ.copy()
+ env['FLAGFILE'] = userargs[0].split('=')[-1]
+ env['NETWORK_ID'] = userargs[1].split('=')[-1]
+ return env