Jiří Moskovčák has uploaded a new change for review.

Change subject: load also pyc files when loading submonitors
......................................................................

load also pyc files when loading submonitors

Change-Id: I0dae460264f5cb0b5d83637344331ea56f8bfadd
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1151344
Signed-off-by: Jiri Moskovcak <[email protected]>
---
M ovirt_hosted_engine_ha/broker/monitor.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha 
refs/changes/00/35900/1

diff --git a/ovirt_hosted_engine_ha/broker/monitor.py 
b/ovirt_hosted_engine_ha/broker/monitor.py
index b44fc33..4207faa 100644
--- a/ovirt_hosted_engine_ha/broker/monitor.py
+++ b/ovirt_hosted_engine_ha/broker/monitor.py
@@ -38,8 +38,9 @@
         smdir = os.path.join(os.path.dirname(submonitor_base.__file__),
                              "submonitors")
         self._log.info("Searching for submonitors in %s", smdir)
-        for filename in (f for f in os.listdir(smdir) if f.endswith('.py')):
-            name = filename[:-3]
+        for filename in (f for f in os.listdir(smdir) if
+                         (f.endswith('.py') or f.endswith('.pyc'))):
+            name = filename[:filename.rindex('.')]
             # TODO better error handling for __init__ and badly-written files
             module = imp.find_module(name, [smdir])
             sm = imp.load_module(name, *module)


-- 
To view, visit http://gerrit.ovirt.org/35900
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0dae460264f5cb0b5d83637344331ea56f8bfadd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Jiří Moskovčák <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to