Update rootwrap with code from oslo.

Change-Id: I30f1b8773840c098f1e38d09bf13f0863035289e
This commit is contained in:
Monty Taylor
2013-05-02 10:26:37 -04:00
parent 33b966771b
commit 9c5890cb78
3 changed files with 8 additions and 6 deletions

View File

@@ -17,6 +17,6 @@
# limitations under the License. # limitations under the License.
# Temporary shim to do a devstack transition # Temporary shim to do a devstack transition
from nova.cmd import rootwrap from nova.openstack.common.rootwrap import cmd
rootwrap.main() cmd.main()

View File

@@ -33,6 +33,8 @@
they are needed, to avoid allowing more than is necessary. they are needed, to avoid allowing more than is necessary.
""" """
from __future__ import print_function
import ConfigParser import ConfigParser
import logging import logging
import os import os
@@ -55,10 +57,10 @@ def _subprocess_setup():
def _exit_error(execname, message, errorcode, log=True): def _exit_error(execname, message, errorcode, log=True):
print "%s: %s" % (execname, message) print("%s: %s" % (execname, message))
if log: if log:
logging.error(message) logging.error(message)
return(errorcode) sys.exit(errorcode)
def main(): def main():
@@ -115,7 +117,7 @@ def main():
preexec_fn=_subprocess_setup, preexec_fn=_subprocess_setup,
env=filtermatch.get_environment(userargs)) env=filtermatch.get_environment(userargs))
obj.wait() obj.wait()
return(obj.returncode) sys.exit(obj.returncode)
except wrapper.FilterMatchNotExecutable as exc: except wrapper.FilterMatchNotExecutable as exc:
msg = ("Executable not found: %s (filter match = %s)" msg = ("Executable not found: %s (filter match = %s)"

View File

@@ -48,7 +48,7 @@ console_scripts =
nova-network = nova.cmd.network:main nova-network = nova.cmd.network:main
nova-novncproxy = nova.cmd.novncproxy:main nova-novncproxy = nova.cmd.novncproxy:main
nova-objectstore = nova.cmd.objectstore:main nova-objectstore = nova.cmd.objectstore:main
nova-rootwrap = nova.cmd.rootwrap:main nova-rootwrap = nova.openstack.common.rootwrap.cmd:main
nova-scheduler = nova.cmd.scheduler:main nova-scheduler = nova.cmd.scheduler:main
nova-spicehtml5proxy = nova.cmd.spicehtml5proxy:main nova-spicehtml5proxy = nova.cmd.spicehtml5proxy:main
nova-xvpvncproxy = nova.cmd.xvpvncproxy:main nova-xvpvncproxy = nova.cmd.xvpvncproxy:main