Irit Goihman has uploaded a new change for review.

Change subject: sos report: added full module name to _importVdsmPylibModule
......................................................................

sos report: added full module name to _importVdsmPylibModule

sos report cannot import modules directly from vdsm package because
the plugin name is vdsm.
The current hack in the module fails to import other vdsm modules
and complaining about 'relative import in non-package'.
imp.load_modules needs full name of module with its parent packages
in order to import modules relative to the module.

Change-Id: Iab7570d843590ac5fccb669cb13bc758b218655f
Signed-off-by: Irit Goihman <igoih...@redhat.com>
---
M vdsm/sos/vdsm.py.in
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/60627/1

diff --git a/vdsm/sos/vdsm.py.in b/vdsm/sos/vdsm.py.in
index b173426..862c6e4 100644
--- a/vdsm/sos/vdsm.py.in
+++ b/vdsm/sos/vdsm.py.in
@@ -34,7 +34,10 @@
     from distutils.sysconfig import get_python_lib
     modFile, modPath, modDesc = imp.find_module(
         modName, [os.path.join(get_python_lib(False), "vdsm")])
-    mod = imp.load_module(modName, modFile, modPath, modDesc)
+    fullName =  os.path.splitext(modPath)[0].replace(os.path.sep, '.')
+    index = fullName.find("vdsm")
+    fullName = fullName[index:]
+    mod = imp.load_module(fullName, modFile, modPath, modDesc)
     return mod
 
 


-- 
To view, visit https://gerrit.ovirt.org/60627
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab7570d843590ac5fccb669cb13bc758b218655f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Irit Goihman <igoih...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to