Merge "Fix using filter() to meet python2,3"

This commit is contained in:
Jenkins 2016-09-01 08:11:49 +00:00 committed by Gerrit Code Review
commit 0bf7e9b66d

View File

@ -65,8 +65,8 @@ def get_vir_network_dhcp_lease(conn, vm_name):
network = conn.networkLookupByName('vagrant-private-dhcp') network = conn.networkLookupByName('vagrant-private-dhcp')
dhcp_leases = libvirt.virNetwork.DHCPLeases(network) dhcp_leases = libvirt.virNetwork.DHCPLeases(network)
vm_dhcp_leases = filter(lambda lease: lease['mac'] == mac_address, vm_dhcp_leases = [lease for lease in dhcp_leases
dhcp_leases) if lease['mac'] == mac_address]
newest_vm_dhcp_lease = sorted(vm_dhcp_leases, newest_vm_dhcp_lease = sorted(vm_dhcp_leases,
key=operator.itemgetter('expirytime'), key=operator.itemgetter('expirytime'),