Sha256: 6726691faaaf2b175ba543503b26ca0def8e95c934d3e93c5d9b9875d4bb9efd

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

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)
          if env[:machine].provider.pd_version_satisfies?('>= 10')
            super
          else
            # Just continue if port forwarding is not supporting
            @app.call(env)
          end
        end

        def recover(env)
          if env[:machine].provider.pd_version_satisfies?('>= 10')
            super
          end
          # Do nothing if port forwarding is not supporting
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-parallels-1.2.2 lib/vagrant-parallels/action/handle_forwarded_port_collisions.rb