From cdee8ccf632210321c561fdb9da097fa4414a887 Mon Sep 17 00:00:00 2001 From: tierno Date: Tue, 25 Apr 2017 13:42:06 +0200 Subject: [PATCH] Fix import problems of vimconnector Change-Id: I756c5309bbefffddcfda7e76d0d0f11bdb12c81c Signed-off-by: tierno --- osm_ro/nfvo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osm_ro/nfvo.py b/osm_ro/nfvo.py index 624be51b..4c61cb45 100644 --- a/osm_ro/nfvo.py +++ b/osm_ro/nfvo.py @@ -148,13 +148,13 @@ def start_service(mydb): module_info=None try: module = "vimconn_" + vim["type"] - module_info = imp.find_module(module) + module_info = imp.find_module(module, [__file__[:__file__.rfind("/")]]) vim_conn = imp.load_module(vim["type"], *module_info) vimconn_imported[vim["type"]] = vim_conn except (IOError, ImportError) as e: if module_info and module_info[0]: file.close(module_info[0]) - raise NfvoException("Unknown vim type '{}'. Can not open file '{}.py'; {}: {}".format( + raise NfvoException("Unknown vim type '{}'. Cannot open file '{}.py'; {}: {}".format( vim["type"], module, type(e).__name__, str(e)), HTTP_Bad_Request) thread_id = vim['datacenter_tenant_id'] @@ -270,7 +270,7 @@ def get_vim(mydb, nfvo_tenant=None, datacenter_id=None, datacenter_name=None, da module_info=None try: module = "vimconn_" + vim["type"] - module_info = imp.find_module(module) + module_info = imp.find_module(module, [__file__[:__file__.rfind("/")]]) vim_conn = imp.load_module(vim["type"], *module_info) vimconn_imported[vim["type"]] = vim_conn except (IOError, ImportError) as e: @@ -2751,7 +2751,7 @@ def new_datacenter(mydb, datacenter_descriptor): module_info = None try: module = "vimconn_" + datacenter_type - module_info = imp.find_module(module) + module_info = imp.find_module(module, [__file__[:__file__.rfind("/")]]) except (IOError, ImportError): if module_info and module_info[0]: file.close(module_info[0]) -- 2.25.1