mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Catch on empty Virtualbox network addr #43427
This commit is contained in:
parent
0cd493b691
commit
534faf0b7a
1 changed files with 4 additions and 1 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue