Merge pull request #44158 from rallytime/bp-44089

Back-port #44089 to 2016.11
This commit is contained in:
Mike Place 2017-10-19 15:38:14 -05:00 committed by GitHub
commit 715edc0cea

View file

@ -278,7 +278,10 @@ def vb_get_network_addresses(machine_name=None, machine=None):
# We can't trust virtualbox to give us up to date guest properties if the machine isn't running
# For some reason it may give us outdated (cached?) values
if machine.state == _virtualboxManager.constants.MachineState_Running:
total_slots = int(machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/Count"))
try:
total_slots = int(machine.getGuestPropertyValue('/VirtualBox/GuestInfo/Net/Count'))
except ValueError:
total_slots = 0
for i in range(total_slots):
try:
address = machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/{0}/V4/IP".format(i))