Am 2. Dezember 2010 11:04 schrieb Miguel Di Ciurcio Filho <[email protected]>: > --- a/lib/hypervisor/hv_kvm.py > +++ b/lib/hypervisor/hv_kvm.py > @@ -836,7 +836,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): > match = cls._VERSION_RE.search(result.output.splitlines()[0]) > if not match: > return None > - return (match.group(0), match.group(1), match.group(2), match.group(3)) > + > + try: > + return (match.group(0), int(match.group(1)), int(match.group(2)), > + int(match.group(3))) > + except ValueError: > + return None
Ganeti uses two spaces for indentation. Just use plain int() and let the exception propagate. If the version ever becomes non-numeric, changes are needed anyway. And you would silently swallow the error, which is not good (see logging.exception). Michael
