-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added wrapper for action 'handle_forwarded port_collisions'.
It allows to skip calling the builtin action if port forwarding is not supported (PD < 10)
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/vagrant-parallels/action/handle_forwarded_port_collisions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module VagrantPlugins | ||
module Parallels | ||
module Action | ||
class HandleForwardedPortCollisions < Vagrant::Action::Builtin::HandleForwardedPortCollisions | ||
def initialize(app, env) | ||
@app = app | ||
@logger = Log4r::Logger.new('vagrant_parallels::action::handle_port_collisions') | ||
end | ||
|
||
# This middleware just wraps the builtin action and allows to skip it if | ||
# port forwarding is not supported for current Parallels Desktop version. | ||
def call(env) | ||
# Port Forwarding feature is available only with PD >= 10 | ||
if !env[:machine].provider.pd_version_satisfies?('>= 10') | ||
return @app.call(env) | ||
end | ||
|
||
# Call the builtin action | ||
super | ||
end | ||
end | ||
end | ||
end | ||
end |