1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-03 08:21:58 +03:00

examples/dhcp*: Fix None comparison

None should be compared with "is None" instead of "== None", as the
later would invoke a "__cmp__()" method.

Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
Philipp Hahn
2018-11-21 09:10:27 +01:00
committed by Philipp Hahn
parent 6aa02b3292
commit a19f086831
2 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ except libvirt.libvirtError:
sys.exit(0)
leases = net.DHCPLeases()
if (leases == None):
if not leases:
print("Failed to get leases for %s" % net.name())
sys.exit(0)

View File

@ -12,7 +12,7 @@ IPTYPE = {
def print_dom_ifaces(dom):
ifaces = dom.interfaceAddresses(libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)
if (ifaces == None):
if ifaces is None:
print("Failed to get domain interfaces")
sys.exit(0)