Pull VM config child classes into their own files
This commit is contained in:
parent
627b75d945
commit
af32d1f8ca
|
@ -1,3 +1,5 @@
|
|||
require 'vagrant/config/vm/sub_vm'
|
||||
|
||||
module Vagrant
|
||||
class Config
|
||||
class VMConfig < Base
|
||||
|
@ -21,16 +23,6 @@ module Vagrant
|
|||
attr_writer :shared_folder_gid
|
||||
attr_accessor :system
|
||||
|
||||
# Represents a SubVM. This class is only used here in the VMs
|
||||
# hash.
|
||||
class SubVM
|
||||
include Util::StackedProcRunner
|
||||
|
||||
def options
|
||||
@options ||= {}
|
||||
end
|
||||
end
|
||||
|
||||
def initialize
|
||||
@forwarded_ports = {}
|
||||
@shared_folders = {}
|
||||
|
@ -95,11 +87,17 @@ module Vagrant
|
|||
end
|
||||
|
||||
def define(name, options=nil, &block)
|
||||
name = name.to_sym
|
||||
options ||= {}
|
||||
|
||||
# Add the name to the array of VM keys. This array is used to
|
||||
# preserve the order in which VMs are defined.
|
||||
defined_vm_keys << name
|
||||
defined_vms[name.to_sym] ||= SubVM.new
|
||||
defined_vms[name.to_sym].options.merge!(options)
|
||||
defined_vms[name.to_sym].push_proc(&block)
|
||||
|
||||
# Add the SubVM to the hash of defined VMs
|
||||
defined_vms[name] ||= SubVM.new
|
||||
defined_vms[name].options.merge!(options)
|
||||
defined_vms[name].push_proc(&block)
|
||||
end
|
||||
|
||||
def validate(errors)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
module Vagrant
|
||||
class Config
|
||||
class VMConfig < Base
|
||||
# Represents a single sub-VM in a multi-VM environment.
|
||||
class SubVM
|
||||
include Util::StackedProcRunner
|
||||
|
||||
attr_reader :options
|
||||
|
||||
def initialize
|
||||
@options = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue