From 241df0d5f4e520eae0d315f200e53cd8226df56b Mon Sep 17 00:00:00 2001 From: Sumit Jamgade Date: Mon, 13 May 2019 14:23:43 +0200 Subject: [PATCH] allow building docs without ceilometer client CeilometerClient has been deprecated and is no longer available for master. Without ceilometer client installed docs fail to build with an exception [1]. This patch marks the import optional. 1 - Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/sphinx/config.py", line 368, in eval_config_file execfile_(filename, namespace) File "/usr/lib/python2.7/site-packages/sphinx/util/pycompat.py", line 150, in execfile_ exec_(code, _globals) File "/usr/lib/python2.7/site-packages/six.py", line 709, in exec_ exec(""exec _code_ in _globs_, _locs_"") File "", line 1, in File "/home/abuild/rpmbuild/BUILD/python-watcher-2.1.0.dev45/doc/source/conf.py", line 20, in objects.register_all() File "/home/abuild/rpmbuild/BUILD/python-watcher-2.1.0.dev45/watcher/objects/__init__.py", line 31, in register_all __import__('watcher.objects.action_plan') File "/home/abuild/rpmbuild/BUILD/python-watcher-2.1.0.dev45/watcher/objects/action_plan.py", line 78, in from watcher import conf File "/home/abuild/rpmbuild/BUILD/python-watcher-2.1.0.dev45/watcher/conf/__init__.py", line 28, in from watcher.conf import datasources File "/home/abuild/rpmbuild/BUILD/python-watcher-2.1.0.dev45/watcher/conf/datasources.py", line 21, in from watcher.datasources import manager File "/home/abuild/rpmbuild/BUILD/python-watcher-2.1.0.dev45/watcher/datasources/manager.py", line 19, in from watcher.datasources import ceilometer as ceil File "/home/abuild/rpmbuild/BUILD/python-watcher-2.1.0.dev45/watcher/datasources/ceilometer.py", line 21, in from ceilometerclient import exc ImportError: No module named ceilometerclient ) Change-Id: Idcf582c2495aab39aacf691b687759405bb94dca --- watcher/datasources/ceilometer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/watcher/datasources/ceilometer.py b/watcher/datasources/ceilometer.py index 290c1d7ed..28e3eeee7 100644 --- a/watcher/datasources/ceilometer.py +++ b/watcher/datasources/ceilometer.py @@ -18,7 +18,6 @@ import datetime -from ceilometerclient import exc from oslo_log import log from oslo_utils import timeutils @@ -31,6 +30,13 @@ from watcher.datasources import base LOG = log.getLogger(__name__) +try: + from ceilometerclient import exc + HAS_CEILCLIENT = True +except ImportError: + HAS_CEILCLIENT = False + + class CeilometerHelper(base.DataSourceBase): NAME = 'ceilometer'