Use get() instead of direct dict reference

This commit is contained in:
Joshua Boniface 2020-01-06 16:34:39 -05:00
parent a0542d61d0
commit 2d2bdb879e
1 changed files with 3 additions and 3 deletions

View File

@ -171,9 +171,9 @@ class MetadataAPIInstance(object):
pass
# Get our real information on the host; now we can start querying about it
client_hostname = host_information['hostname']
client_macaddr = host_information['mac_address']
client_ipaddr = host_information['ip4_address']
client_hostname = host_information.get('hostname', None)
client_macaddr = host_information.get('mac_address', None)
client_ipaddr = host_information.get('ip4_address', None)
# Find the VM with that MAC address - we can't assume that the hostname is actually right
_discard, vm_list = pvc_vm.get_list(self.zk_conn, None, None, None)