Sha256: c90919261eb0860b1f1f179e599f413f66ba1cf11db22f630cd34a4f9efe3c4f

Contents?: true

Size: 669 Bytes

Versions: 8

Compression:

Stored size: 669 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)
          logged = false

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

            if !logged
              env.logger.info "Disabling host only networks..."
              logged = true
            end

            adapter.enabled = false
            adapter.save
          end

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
vagrantup-0.5.4 lib/vagrant/action/vm/disable_networks.rb
vagrantup-0.5.3 lib/vagrant/action/vm/disable_networks.rb
vagrantup-0.5.2 lib/vagrant/action/vm/disable_networks.rb
vagrantup-0.5.1 lib/vagrant/action/vm/disable_networks.rb
vagrant-0.5.4 lib/vagrant/action/vm/disable_networks.rb
vagrant-0.5.3 lib/vagrant/action/vm/disable_networks.rb
vagrant-0.5.2 lib/vagrant/action/vm/disable_networks.rb
vagrant-0.5.1 lib/vagrant/action/vm/disable_networks.rb