Merge "Fix python lib path for ixload control subprocess"
authorAbhijit Sinha <abhijit.sinha@intel.com>
Mon, 5 Nov 2018 14:24:48 +0000 (14:24 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Mon, 5 Nov 2018 14:24:48 +0000 (14:24 +0000)
yardstick/network_services/traffic_profile/http_ixload.py

index 3ccec63..9210f3c 100644 (file)
@@ -16,6 +16,14 @@ import sys
 import os
 import logging
 import collections
+import subprocess
+try:
+    libs = subprocess.check_output(
+        'python -c "import site; print(site.getsitepackages())"', shell=True)
+
+    sys.path.extend(libs[1:-1].replace("'", "").split(','))
+except subprocess.CalledProcessError:
+    pass
 
 # ixload uses its own py2. So importing jsonutils fails. So adding below
 # workaround to support call from yardstick
@@ -24,7 +32,7 @@ try:
 except ImportError:
     import json as jsonutils
 
-from yardstick.common import exceptions
+from yardstick.common import exceptions #pylint: disable=wrong-import-position
 
 try:
     from IxLoad import IxLoad, StatCollectorUtils