Saggi Mizrahi has posted comments on this change. Change subject: tool: autoload modules. ......................................................................
Patch Set 3: (2 comments) http://gerrit.ovirt.org/#/c/34049/3/lib/vdsm/tool/configurator.py File lib/vdsm/tool/configurator.py: Line 84: def _import_module(abspkg, mname): Line 85: """return imported module mname from abspkg.""" Line 86: # remove this function and use importlib once python version >= 2.7 Line 87: pkg = "%s.%s" % (abspkg.__name__, mname) Line 88: __import__(pkg, level=0) comment on why you are not just returning the result of __import__ Line 89: return sys.modules[pkg] Line 90: Line 91: Line 92: def _listmodules(pkg): Line 100: for module in glob("%s*.py" % path) Line 101: if filter_(getmname(module)) Line 102: ] Line 103: Line 104: _CONFIGURATORS = {} I'd prefer if this was lazy loaded since it's a lot of work to do during import. Line 105: for module in _listmodules(configurators): Line 106: _CONFIGURATORS[module] = _import_module(configurators, module) Line 107: Line 108: -- To view, visit http://gerrit.ovirt.org/34049 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6cc14a1c409ee607e18d42adcd8a54759d8dbf6d Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: mooli tayer <mta...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Dima Kuznetsov <dkuzn...@redhat.com> Gerrit-Reviewer: Ohad Basan <oba...@redhat.com> Gerrit-Reviewer: Saggi Mizrahi <smizr...@redhat.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: Yeela Kaplan <ykap...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: mooli tayer <mta...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches