plugins/kernel_v2/config/vm.rb
#-------------------------------------------------------------------
# Internal methods, don't call these.
#-------------------------------------------------------------------
Internal methods, don't call these.
Internal methods don ' t call these .
def finalize!
        @base_mac = nil if @base_mac == UNSET_VALUE
        @boot_timeout = 300 if @boot_timeout == UNSET_VALUE
        @box_check_update = true if @box_check_update == UNSET_VALUE
        @box_download_ca_cert = nil if @box_download_ca_cert == UNSET_VALUE
        @box_download_checksum = nil if @box_download_checksum == UNSET_VALUE
        @box_download_checksum_type = nil if @box_download_checksum_type == UNSET_VALUE
        @box_download_client_cert = nil if @box_download_client_cert == UNSET_VALUE
        @box_download_insecure = false if @box_download_insecure == UNSET_VALUE
        @box_url = nil if @box_url == UNSET_VALUE
        @box_version = ">= 0" if @box_version == UNSET_VALUE
        @graceful_halt_timeout = 60 if @graceful_halt_timeout == UNSET_VALUE
        @guest = nil if @guest == UNSET_VALUE
        @hostname = nil if @hostname == UNSET_VALUE
        @hostname = @hostname.to_s if @hostname
        if @usable_port_range == UNSET_VALUE
          @usable_port_range = (2200..2250)
        end
        @box_download_checksum = "" if !@box_download_checksum
        if @box_download_checksum_type
          @box_download_checksum_type = @box_download_checksum_type.to_sym
        end
        @box_url = Array(@box_url) if @box_url
        @guest = @guest.to_sym if @guest
        define(DEFAULT_VM_NAME) if defined_vm_keys.empty?
        if !@__networks["ssh"]
          network :forwarded_port,
            guest: 22,
            host: 2222,
            host_ip: "127.0.0.1",
            id: "ssh",
            auto_correct: true
        end
        @__networks.values.each do |type, opts|
          if type == :forwarded_port
            opts[:guest] = opts[:guest].to_i if opts[:guest]
            opts[:host] = opts[:host].to_i if opts[:host]
          end
        end
        @__providers.each do |name, blocks|
          next if blocks.empty?
          config_class = Vagrant.plugin("2").manager.provider_configs[name]
          config_class ||= Vagrant::Config::V2::DummyConfig
          config    = config_class.new
          begin
            blocks.each do |b|
              b.call(config, Vagrant::Config::V2::DummyConfig.new)
            end
          rescue Exception => e
            raise Vagrant::Errors::VagrantfileLoadError,
              path: "<provider config: #{name}>",
              message: e.message
          end
          config.finalize!
          @__compiled_provider_configs[name]   = config
        end
        @provisioners.each do |p|
          p.config.finalize! if !p.invalid?
        end
        if !@__synced_folders["/vagrant"]
          synced_folder(".", "/vagrant")
        end
        @__synced_folders.each do |id, options|
          if options[:nfs]
            options[:type] = :nfs
          end
          if options[:type] == :nfs && Vagrant::Util::Platform.windows?
            options.delete(:type)
          end
        end
        @__finalized = true
      end
def finalize! @base_mac = nil if @base_mac == UNSET_VALUE @boot_timeout = 300 if @boot_timeout == UNSET_VALUE @box_check_update = true if @box_check_update == UNSET_VALUE @box_download_ca_cert = nil if @box_download_ca_cert == UNSET_VALUE @box_download_checksum = nil if @box_download_checksum == UNSET_VALUE @box_download_checksum_type = nil if @box_download_checksum_type == UNSET_VALUE @box_download_client_cert = nil if @box_download_client_cert == UNSET_VALUE @box_download_insecure = false if @box_download_insecure == UNSET_VALUE @box_url = nil if @box_url == UNSET_VALUE @box_version = ">= 0" if @box_version == UNSET_VALUE @graceful_halt_timeout = 60 if @graceful_halt_timeout == UNSET_VALUE @guest = nil if @guest == UNSET_VALUE @hostname = nil if @hostname == UNSET_VALUE @hostname = @hostname . to_s if @hostname if @usable_port_range == UNSET_VALUE @usable_port_range = ( 2200 .. 2250 ) end @box_download_checksum = "" if ! @box_download_checksum if @box_download_checksum_type @box_download_checksum_type = @box_download_checksum_type . to_sym end @box_url = Array ( @box_url ) if @box_url @guest = @guest . to_sym if @guest define ( DEFAULT_VM_NAME ) if defined_vm_keys . empty? if ! @__networks [ "ssh" ] network :forwarded_port , guest : 22 , host : 2222 , host_ip : "127.0.0.1" , id : "ssh" , auto_correct : true end @__networks . values . each do | type , opts | if type == :forwarded_port opts [ :guest ] = opts [ :guest ] . to_i if opts [ :guest ] opts [ :host ] = opts [ :host ] . to_i if opts [ :host ] end end @__providers . each do | name , blocks | next if blocks . empty? config_class = Vagrant . plugin ( "2" ) . manager . provider_configs [ name ] config_class ||= Vagrant :: Config :: V2 :: DummyConfig config = config_class . new begin blocks . each do | b | b . call ( config , Vagrant :: Config :: V2 :: DummyConfig . new ) end rescue Exception => e raise Vagrant :: Errors :: VagrantfileLoadError , path : "<provider config: #{name}>" , message : e . message end config . finalize! @__compiled_provider_configs [ name ] = config end @provisioners . each do | p | p . config . finalize! if ! p . invalid? end if ! @__synced_folders [ "/vagrant" ] synced_folder ( "." , "/vagrant" ) end @__synced_folders . each do | id , options | if options [ :nfs ] options [ :type ] = :nfs end if options [ :type ] == :nfs && Vagrant :: Util :: Platform . windows? options . delete ( :type ) end end @__finalized = true end
Internal methods, don't call these.
Internal methods don ' t call these .
# Defaults # Make sure that the download checksum is a string and that # the type is a symbol # Make sure the box URL is an array if it is set # Set the guest properly # If we haven't defined a single VM, then we need to define a # default VM which just inherits the rest of the configuration. # Make sure the SSH forwarding is added if it doesn't exist # Clean up some network configurations # Compile all the provider configurations # If we don't have any configuration blocks, then ignore it # Find the configuration class for this provider # Load it up # Store it for retrieval later # Finalize all the provisioners # If we didn't share our current directory, then do it # manually. # Ignore NFS on Windows # Flag that we finalized