Sha256: f91462b937ae8af5f85a86faa37f63bf030811290c1d2b2126e3947e02850be3

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'vagrant'
require 'auto_network/action'

module AutoNetwork
  class Plugin < Vagrant.plugin('2')
    name 'auto_network'

    description <<-DESC
    This plugin adds support for automatically configuring Vagrant hostonly
    networks.
    DESC

    action_hook('Auto network: initialize address pool') do |hook|
      hook.prepend AutoNetwork::Action::LoadPool
    end

    action_hook('Auto network: filter private networks', :environment_load) do |hook|
      action = AutoNetwork::Action::LoadPool
      hook.after(action, AutoNetwork::Action::FilterNetworks)
    end

    action_hook('Auto network: request address') do |hook|
      action = Vagrant::Action::Builtin::ConfigValidate
      hook.before(action, AutoNetwork::Action::Request)
    end

    action_hook('Auto network: release address', :machine_action_destroy) do |hook|
      # This is redundant, but the VirtualBox Destroy Action flushes UUID
      # values. So we double the  hook here as it is our only chance to clean
      # old-style IDs out of the cache.
      hook.before(VagrantPlugins::ProviderVirtualBox::Action::Destroy, AutoNetwork::Action::Release)

      hook.append(AutoNetwork::Action::Release)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-auto_network-1.0.0.beta1 lib/auto_network/plugin.rb