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:
committed by
Philipp Hahn
parent
6aa02b3292
commit
a19f086831
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user