Do not import anything from quantum into rootwrap
The rootwrapper is special and shouldn't do heavy code loading, first for performance and 2nd for potential security issues. It shaves off 0.2s of load time (aka heavy cpu usage when using openvswitch as it invokes rootwrap twice every 4 seconds) Fixes LP bug 1190675 This is reverting bug 1053381 Author: Gary Kotton <gkotton@redhat.com> Date: Sun Sep 23 08:34:33 2012 +0000 Uses a common subprocess popen function Change-Id: I629d90aaeb99b225d716da82c6ac5c3f327ebb67
This commit is contained in:
parent
d2984648dc
commit
8917451b36
@ -39,16 +39,21 @@
|
||||
import ConfigParser
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from quantum.common import utils
|
||||
|
||||
|
||||
RC_UNAUTHORIZED = 99
|
||||
RC_NOCOMMAND = 98
|
||||
RC_BADCONFIG = 97
|
||||
|
||||
|
||||
def _subprocess_setup():
|
||||
# Python installs a SIGPIPE handler by default. This is usually not what
|
||||
# non-Python subprocesses expect.
|
||||
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Split arguments, require at least a command
|
||||
execname = sys.argv.pop(0)
|
||||
@ -82,11 +87,12 @@ if __name__ == '__main__':
|
||||
filters = wrapper.load_filters(filters_path)
|
||||
filtermatch = wrapper.match_filter(filters, userargs)
|
||||
if filtermatch:
|
||||
obj = utils.subprocess_popen(filtermatch.get_command(userargs),
|
||||
stdin=sys.stdin,
|
||||
stdout=sys.stdout,
|
||||
stderr=sys.stderr,
|
||||
env=filtermatch.get_environment(userargs))
|
||||
obj = subprocess.Popen(filtermatch.get_command(userargs),
|
||||
stdin=sys.stdin,
|
||||
stdout=sys.stdout,
|
||||
stderr=sys.stderr,
|
||||
preexec_fn=_subprocess_setup,
|
||||
env=filtermatch.get_environment(userargs))
|
||||
obj.wait()
|
||||
sys.exit(obj.returncode)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user