Return nil if the VM is not running when looking at forwarded ports
This commit is contained in:
parent
beb84d3212
commit
f20c08f57f
|
@ -9,6 +9,8 @@ module VagrantPlugins
|
||||||
#
|
#
|
||||||
# @return [Hash<Integer, Integer>] Host => Guest port mappings.
|
# @return [Hash<Integer, Integer>] Host => Guest port mappings.
|
||||||
def self.forwarded_ports(machine)
|
def self.forwarded_ports(machine)
|
||||||
|
return nil if machine.state.id != :running
|
||||||
|
|
||||||
{}.tap do |result|
|
{}.tap do |result|
|
||||||
machine.provider.driver.read_forwarded_ports.each do |_, _, h, g|
|
machine.provider.driver.read_forwarded_ports.each do |_, _, h, g|
|
||||||
result[h] = g
|
result[h] = g
|
||||||
|
|
Loading…
Reference in New Issue