Check if a port is open prior to forwarding [GH-821]
This commit is contained in:
parent
d08a65e7f7
commit
c1445a0130
|
@ -13,6 +13,8 @@
|
|||
- Chef-solo provisioner now supports encrypted data bags. [GH-816]
|
||||
- Enable the NAT DNS proxy by default, allowing your DNS to continue
|
||||
working when you switch networks. [GH-834]
|
||||
- Checking for port forwarding collisions also checks for other applications
|
||||
that are potentially listening on that port as well. [GH-821]
|
||||
|
||||
## 1.0.1 (March 11, 2012)
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
require "vagrant/util/is_port_open"
|
||||
|
||||
module Vagrant
|
||||
module Action
|
||||
module VM
|
||||
# Action that checks to make sure there are no forwarded port collisions,
|
||||
# and raises an exception if there is.
|
||||
class CheckPortCollisions
|
||||
include Util::IsPortOpen
|
||||
|
||||
def initialize(app, env)
|
||||
@app = app
|
||||
end
|
||||
|
@ -29,7 +33,7 @@ module Vagrant
|
|||
hostport = options[:hostport].to_i
|
||||
hostport = current[options[:name]] if current.has_key?(options[:name])
|
||||
|
||||
if existing.include?(hostport)
|
||||
if existing.include?(hostport) || is_port_open?("localhost", hostport)
|
||||
# We have a collision! Handle it
|
||||
send("handle_#{handler}".to_sym, options, existing)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue