Initialise oslo.privsep early in main

Any process using oslo.privsep should now initialise the library before
first use with things like the rootwrap command to use.

This should be done near the top of main() in any command that expects
to make privileged calls via oslo.privsep (eg: cinder-volume, and not
cinder-api).

See I3ea73e16b07a870629e7d69e897f2524d7068ae8 for the corresponding
change in oslo.privsep.

Change-Id: Id9652ccf001a707fbd59e277c36817bd6d58e7b3
Closes-Bug: #1592043
This commit is contained in:
Angus Lees 2016-06-21 17:01:53 +10:00 committed by lisali
parent 5097a9eff5
commit 742ebf467f
3 changed files with 7 additions and 0 deletions

View File

@ -18,11 +18,13 @@
"""Starter script for Cinder Volume Backup."""
import logging as python_logging
import shlex
import sys
import eventlet
from oslo_config import cfg
from oslo_log import log as logging
from oslo_privsep import priv_context
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
@ -49,6 +51,7 @@ def main():
version=version.version_string())
logging.setup(CONF, "cinder")
python_logging.captureWarnings(True)
priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
utils.monkey_patch()
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
server = service.Service.create(binary='cinder-backup')

View File

@ -31,10 +31,12 @@ if os.name == 'nt':
else:
eventlet.monkey_patch()
import shlex
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_privsep import priv_context
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
@ -64,6 +66,7 @@ def main():
version=version.version_string())
logging.setup(CONF, "cinder")
python_logging.captureWarnings(True)
priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
utils.monkey_patch()
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
launcher = service.get_launcher()

View File

@ -22,6 +22,7 @@ oslo.log>=1.14.0 # Apache-2.0
oslo.messaging>=5.2.0 # Apache-2.0
oslo.middleware>=3.0.0 # Apache-2.0
oslo.policy>=1.9.0 # Apache-2.0
oslo.privsep>=1.9.0 # Apache-2.0
oslo.reports>=0.6.0 # Apache-2.0
oslo.rootwrap>=2.0.0 # Apache-2.0
oslo.serialization>=1.10.0 # Apache-2.0