Change in vdsm[master]: Functional Tests [2/3]: Added ipwrapper.ruleExists+routeExists

asegurap at redhat.com asegurap at redhat.com
Tue Aug 20 12:07:06 UTC 2013


Antoni Segura Puimedon has posted comments on this change.

Change subject: Functional Tests [2/3]: Added ipwrapper.ruleExists+routeExists
......................................................................


Patch Set 3:

(2 comments)

....................................................
File lib/vdsm/ipwrapper.py
Line 251:     command += route
Line 252:     _execCmd(command)
Line 253: 
Line 254: 
Line 255: def _getValidEntries(ofType, outOf):
How about this:

    def _getValidEntries(constructor, iterator):
        for element in iterator:
            try:
                yield constructor(iterator)
            except ValueError:
                pass

So using code reads:

return route in _getValidEntries(Route.fromText, routeShowTable('all'))
return rule in _getValidEntries(Rule.fromText, ruleList())
Line 256:     for entry in outOf:
Line 257:         try:
Line 258:             yield ofType.fromText(entry)
Line 259:         except ValueError:


Line 260:             pass
Line 261: 
Line 262: 
Line 263: def routeExists(route):
Line 264:     return route in _getValidEntries(ofType=Route,
sorry that my comment was not clearer. I meant something easier:

    return route in (Route.fromText(entry) for entry in routeShowTable('all')
                     if _validate(Route, entry))
  
The same below. Anyway, I guess this is okay too.
Line 265:                                      outOf=routeShowTable('all'))
Line 266: 
Line 267: 
Line 268: def ruleList():


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaf7c28e85f53f51879750308f3a9f93fc635cf33
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Assaf Muller <amuller at redhat.com>
Gerrit-Reviewer: Giuseppe Vallarelli <gvallare at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list