diff options
author | Eric Windisch <eric@cloudscaling.com> | 2013-04-23 10:43:19 -0400 |
---|---|---|
committer | Eric Windisch <eric@cloudscaling.com> | 2013-05-23 11:41:54 -0400 |
commit | b677b13560fc1e670022cefa2d330d84dac2304a (patch) | |
tree | f6a85202dd02a03b5b49f34fa14a2f6c13a91cf3 | |
parent | cc1e163ddcd4de0deb58ff8caeb2afc62200c001 (diff) | |
download | oslo-b677b13560fc1e670022cefa2d330d84dac2304a.tar.gz oslo-b677b13560fc1e670022cefa2d330d84dac2304a.tar.xz oslo-b677b13560fc1e670022cefa2d330d84dac2304a.zip |
Remove rootwrap from IPC directory creation
Removes processutils/rootwrap dependency.
Fixes bug 1160420 and partially fixes 1180631.
The attempt will still be made to create
/var/run/openstack, but will give a reasonable
error when it happens.
If the directory exists, but permissions are denied,
we should also give a reasonable error.
A patch will be submitted to devstack
that will set and create the IPC directory as necessary.
Packagers should do this as well.
Change-Id: I7814320adbfd0b2fe54cc2e523452c18ab2e7687
-rw-r--r-- | openstack/common/rpc/impl_zmq.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py index add3973..c64c772 100644 --- a/openstack/common/rpc/impl_zmq.py +++ b/openstack/common/rpc/impl_zmq.py @@ -30,7 +30,6 @@ from openstack.common import excutils from openstack.common.gettextutils import _ from openstack.common import importutils from openstack.common import jsonutils -from openstack.common import processutils as utils from openstack.common.rpc import common as rpc_common zmq = importutils.try_import('eventlet.green.zmq') @@ -521,23 +520,23 @@ class ZmqProxy(ZmqBaseReactor): CONF.rpc_zmq_port) consumption_proxy = InternalContext(None) - if not os.path.isdir(ipc_dir): - try: - utils.execute('mkdir', '-p', ipc_dir, run_as_root=True) - utils.execute('chown', "%s:%s" % (os.getuid(), os.getgid()), - ipc_dir, run_as_root=True) - utils.execute('chmod', '750', ipc_dir, run_as_root=True) - except utils.ProcessExecutionError: + try: + os.makedirs(ipc_dir) + except os.error: + if not os.path.isdir(ipc_dir): with excutils.save_and_reraise_exception(): - LOG.error(_("Could not create IPC directory %s") % - (ipc_dir, )) - + LOG.error(_("Required IPC directory does not exist at" + " %s") % (ipc_dir, )) try: self.register(consumption_proxy, consume_in, zmq.PULL, out_bind=True) except zmq.ZMQError: + if os.access(ipc_dir, os.X_OK): + with excutils.save_and_reraise_exception(): + LOG.error(_("Permission denied to IPC directory at" + " %s") % (ipc_dir, )) with excutils.save_and_reraise_exception(): LOG.error(_("Could not create ZeroMQ receiver daemon. " "Socket may already be in use.")) |