From d655e010b87c60cb62475324edfe3893c34ef711 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Thu, 1 Sep 2016 13:38:46 +0100 Subject: [PATCH] Make osprofiler dependency really "soft" In a37b5fe562a85787b74edc48c923aa6343490ec1 osprofiler was changed to a soft requirement. However, if it is missing then mistralclient will currently fail with: AttributeError: 'NoneType' object has no attribute 'get_trace_id_headers' This change checks to see if it was successfully imported before it is used. Depends-On: I1b61bd1de6811a5f65c2375dde956aafe33445b2 Change-Id: Ia742a4e55b35c5a787e4606ff2f91425dd156e5e --- mistralclient/api/httpclient.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mistralclient/api/httpclient.py b/mistralclient/api/httpclient.py index 411a93ea..f04598f1 100644 --- a/mistralclient/api/httpclient.py +++ b/mistralclient/api/httpclient.py @@ -128,7 +128,8 @@ class HTTPClient(object): if target_auth_uri: headers['X-Target-Auth-Uri'] = target_auth_uri - # Add headers for osprofiler. - headers.update(osprofiler_web.get_trace_id_headers()) + if osprofiler_web: + # Add headers for osprofiler. + headers.update(osprofiler_web.get_trace_id_headers()) return headers