Sha256: d7f9c82ddeaef7bc3f870459803cc5508aec278c1ac3f99ea42f837ee3d6e856

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require "vagrant"

module VagrantPlugins
  module HyperVNet
    class Config < Vagrant.plugin("2", :config)

      attr_reader :network_adapters

      attr_accessor :install_ssh_server
      attr_accessor :install_rsync
      attr_accessor :folder_sync_on_provision
      attr_accessor :default_switch

      def initialize        
        @network_adapters = []
        @install_ssh_server = UNSET_VALUE
        @install_rsync = UNSET_VALUE
        @folder_sync_on_provision = UNSET_VALUE
        @default_switch = UNSET_VALUE
  
        network_adapter(:nat)
      end

      def network_adapter(type, **opts)
        @network_adapters <<  [type, opts]
      end

      def finalize!
        @install_ssh_server = true if @install_ssh_server == UNSET_VALUE
        @install_rsync = true if @install_rsync == UNSET_VALUE
        @folder_sync_on_provision = true if @folder_sync_on_provision == UNSET_VALUE
        @default_switch = "Default Switch" if @default_switch == UNSET_VALUE
      end

      def validate(machine)
        errors = _detected_errors

        {"Hyper-V network" => errors}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-hypervnet-0.1.4 lib/vagrant-hypervnet/config.rb