summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2012-11-22 22:57:24 -0800
committerMark McLoughlin <markmc@redhat.com>2012-11-28 17:04:28 +0000
commitf10b956dd5b88b048c582cadc3c22ec5360521c9 (patch)
treeeea6e92d81499cdb29e29eb2f8547f95deb007ea /openstack
parent0ac56f54542ac2068d7881c1befbea4b86075f86 (diff)
downloadoslo-f10b956dd5b88b048c582cadc3c22ec5360521c9.tar.gz
oslo-f10b956dd5b88b048c582cadc3c22ec5360521c9.tar.xz
oslo-f10b956dd5b88b048c582cadc3c22ec5360521c9.zip
Replace try: import with extras.try_import
The block form: try: import foo except: foo = None is confusing to code analysis tools looking for redefinition. It's also a common enough pattern that someone else has encoded it into a library. Let's use that instead. Change-Id: I35a5c7a7e3595a51ba1ef1886c3965f463dba04a
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/service.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/openstack/common/service.py b/openstack/common/service.py
index 0c355f7..910a738 100644
--- a/openstack/common/service.py
+++ b/openstack/common/service.py
@@ -27,6 +27,7 @@ import sys
import time
import eventlet
+import extras
import logging as std_logging
from openstack.common import cfg
@@ -35,11 +36,7 @@ from openstack.common.gettextutils import _
from openstack.common import log as logging
from openstack.common import threadgroup
-try:
- from openstack.common import rpc
-except ImportError:
- rpc = None
-
+rpc = extras.try_import('openstack.common.rpc')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)