Sha256: 8b22ae09d028e56aa3ada530453518c52ec8c8eb0cde5e98a5cc1614f5f57e20

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 Bytes

Contents

module Vagrant
  class Action
    module VM
      # Middleware to disable all host only networks on the
      # VM
      class DisableNetworks
        def initialize(app, env)
          @app = app
          @env = env
        end

        def call(env)
          env.logger.info "Disabling host only networks..."

          env["vm"].vm.network_adapters.each do |adapter|
            next if adapter.attachment_type != :host_only
            adapter.enabled = false
            adapter.save
          end

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
vagrantup-0.5.0 lib/vagrant/action/vm/disable_networks.rb
vagrant-0.5.0 lib/vagrant/action/vm/disable_networks.rb