Change in vdsm[master]: configurator doesn't load pyc files under configurators folder

nsoffer at redhat.com nsoffer at redhat.com
Wed Sep 9 06:26:11 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: configurator doesn't load pyc files under configurators folder
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/45846/2/lib/vdsm/tool/configurator.py
File lib/vdsm/tool/configurator.py:

Line 57:     filter_ = lambda x: not x.startswith('_')
Line 58: 
Line 59:     return set(
Line 60:         getmname(module)
Line 61:         for module in iglob("%s*.py*" % path)
This will match also foo.pybar :-)

We do not expect to have other files except *.py and *.pyc, but this code is wrong, and will fail in the future when used in other context.

This is simpler, more clear and correct:

    is_module = re.compile(r"^[^_].*\.pyc?$").search

    return set(os.path.splitext(name)[0] for name in os.listdir(path) if is_module(name))
Line 62:         if filter_(getmname(module))
Line 63:     )
Line 64: 
Line 65: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia529de0069e2f4ec168a4b9df82ba62c56d66730
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list