Make osprofiler dependency "soft"

All OpenStack clients contain osprofiler as a soft dependency
(profiling works only if osprofiler package is installed already
on the env). This is done intentionally: this allows to avoid its
installation on the client nodes, that are not supposed to present
a profiling client (e.g. non-admin users). Moreover, marking osprofiler
as a strict dependency now leads to bug #1361235 being reproduced
in specific Horizon installations (when horizon is installed in a
python virtualenv along with it's dependencies).

Change-Id: Ifdfaa89995fb2340d7b6540373f41e9f2fd35bcc
Closes-Bug: #1361235
This commit is contained in:
Dina Belova
2016-08-29 17:47:10 -07:00
parent 4ca0906cf6
commit a37b5fe562
4 changed files with 8 additions and 5 deletions

View File

@@ -16,11 +16,12 @@
import copy
import os
from oslo_utils import importutils
import requests
import logging
import osprofiler.web
osprofiler_web = importutils.try_import("osprofiler.web")
LOG = logging.getLogger(__name__)
@@ -128,6 +129,6 @@ class HTTPClient(object):
headers['X-Target-Auth-Uri'] = target_auth_uri
# Add headers for osprofiler.
headers.update(osprofiler.web.get_trace_id_headers())
headers.update(osprofiler_web.get_trace_id_headers())
return headers

View File

@@ -15,7 +15,7 @@
import six
import osprofiler.profiler
from oslo_utils import importutils
from mistralclient.api import httpclient
from mistralclient.api.v2 import action_executions
@@ -32,6 +32,7 @@ from mistralclient.auth import auth_types
from mistralclient.auth import keycloak
from mistralclient.auth import keystone
osprofiler_profiler = importutils.try_import("osprofiler.profiler")
_DEFAULT_MISTRAL_URL = "http://localhost:8989/v2"
@@ -98,7 +99,7 @@ class Client(object):
mistral_url = _DEFAULT_MISTRAL_URL
if profile:
osprofiler.profiler.init(profile)
osprofiler_profiler.init(profile)
if target_auth_url:
keystone.authenticate(

View File

@@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later.
cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
osc-lib>=1.0.2 # Apache-2.0
osprofiler>=1.4.0 # Apache-2.0
oslo.utils>=3.16.0 # Apache-2.0
pbr>=1.6 # Apache-2.0
python-keystoneclient!=2.1.0,>=2.0.0 # Apache-2.0
PyYAML>=3.1.0 # MIT

View File

@@ -11,3 +11,4 @@ mock>=2.0 # BSD
nose # LGPL
tempest>=12.1.0 # Apache-2.0
testtools>=1.4.0 # MIT
osprofiler>=1.4.0 # Apache-2.0