Sha256: 1796c3025594b79f7d211d7cebd45f9ab43f92db2f871e29355494ec5cc9166e

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

require_relative "action"
require_relative "dhcp"

module VagrantPlugins
  module VagrantVmwareDhcp
    class Plugin < Vagrant.plugin("2")
      name "VagrantVmwareDhcp"
      description <<-DESC
      Adds static private IPs to VMware's DHCP configuration so that your networks behave normally.
      Especially nice on multi-vm environments with Windows.
      DESC

      config(:control_dhcp) do
        Config
      end

      action_hook('DA VMware Network: Configure MAC addresses') do |hook|
        action = Vagrant::Action::Builtin::ConfigValidate
        hook.before(action, VagrantVmwareDhcp::Action::SetMac)
      end

      action_hook('DA VMware Network: Configure dhcp.conf') do |hook|
        if defined?(ActionConfigure)
          # no-op
        elsif Vagrant::Util::Platform.windows? or Vagrant::Util::Platform.linux?
          ActionConfigure = HashiCorp::VagrantVMwareworkstation::Action::Network
        elsif Vagrant::Util::Platform.darwin?
          ActionConfigure = HashiCorp::VagrantVMwarefusion::Action::Network
        end

        hook.after(ActionConfigure, VagrantVmwareDhcp::Action::ConfigDhcp)
      end

      action_hook('DA VMware Network: Prune dhcp.conf') do |hook|
        if defined?(ActionPrune)
          # no-op
        elsif Vagrant::Util::Platform.windows? or Vagrant::Util::Platform.linux?
          ActionPrune = HashiCorp::VagrantVMwareworkstation::Action::Destroy
        elsif Vagrant::Util::Platform.darwin?
          ActionPrune = HashiCorp::VagrantVMwarefusion::Action::Destroy
        end

        hook.before(ActionPrune, VagrantVmwareDhcp::Action::PruneDhcp)
      end

      # action_hook(:init_i18n, :environment_load) { init_i18n }
      # def self.init_i18n
      #   I18n.load_path << File.expand_path("locales/en.yml", VagrantVmwareDhcp.source_root)
      #   I18n.reload!
      # end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-vmware-dhcp-0.0.10 lib/vagrant-vmware-dhcp/plugin.rb
vagrant-vmware-dhcp-0.0.9 lib/vagrant-vmware-dhcp/plugin.rb