Class: ConfigBuilder::Model::VM
- Includes:
- ConfigBuilder::ModelDelegator
- Defined in:
- lib/config_builder/model/vm.rb
Overview
Instance Attribute Summary collapse
-
#box ⇒ String
This configures what box the machine will be brought up against.
-
#box_check_update ⇒ Boolean
If true, Vagrant will check for updates to the configured box on every
vagrant up
. -
#box_download_checksum ⇒ String
The checksum of the box specified by
box_url
. -
#box_download_checksum_type ⇒ String
The type of checksum specified by
box_download_checksum
(if any). -
#box_download_client_cert ⇒ String
Path to a client certificate to use when downloading the box, if it is necessary.
-
#box_download_insecure ⇒ Boolean
If
true
, then SSL certificates from the server will not be verified. -
#box_url ⇒ String+
The URL that the configured box can be found at.
-
#box_version ⇒ String
The version of the box to use.
-
#communicator ⇒ String
commands to this box.
-
#forwarded_ports ⇒ Array<Hash<Symbol, Object>>
A collection of port mappings.
-
#guest ⇒ String
The guest type to use for this VM.
-
#hostname ⇒ String
The hostname the machine should have.
-
#name ⇒ String
The name of the instantiated box in this environment.
-
#private_networks ⇒ Array<Hash<Symbol, Object>>
A collection of IP address network settings.
-
#provider ⇒ Hash<Symbol, Object>
The provider configuration for this VM.
-
#providers ⇒ Array<Hash{String, Symbol => Object}>
A collection of provider parameters that should be applied to a VM.
-
#provisioners ⇒ Array<Hash<Symbol, Object>>
A collection of provisioner parameters in the order that they should be applied of provisioner types, and a list of provisioner instances for each type.
- #synced_folders ⇒ Array<Hash<Symbol, Object>>
Instance Method Summary collapse
-
#initialize ⇒ VM
constructor
A new instance of VM.
- #to_proc ⇒ Object
Methods included from ConfigBuilder::ModelDelegator
#eval_models, included, #model_delegators
Methods inherited from Base
#attrs=, #call, def_model_attribute, model_attributes, new_from_hash
Constructor Details
#initialize ⇒ VM
Returns a new instance of VM.
158 159 160 161 162 163 164 165 166 |
# File 'lib/config_builder/model/vm.rb', line 158 def initialize @defaults = { :providers => [], :provisioners => [], :forwarded_ports => [], :private_networks => [], :synced_folders => [], } end |
Instance Attribute Details
#box ⇒ String
Returns This configures what box the machine will be brought up against. The value here should be the name of an installed box or a shorthand name of a box in Vagrant Cloud.
84 |
# File 'lib/config_builder/model/vm.rb', line 84 def_model_attribute :box |
#box_check_update ⇒ Boolean
Returns If true, Vagrant will check for updates to the
configured box on every vagrant up
. If an update is found, Vagrant
will tell the user. By default this is true
. Updates will only be
checked for boxes that properly support updates (boxes from Vagrant
Cloud or some other versioned box).
135 |
# File 'lib/config_builder/model/vm.rb', line 135 def_model_attribute :box_check_update |
#box_download_checksum ⇒ String
Returns The checksum of the box specified by box_url
.
If not specified, no checksum comparison will be done. If specified,
Vagrant will compare the checksum of the downloaded box to this value
and error if they do not match. Checksum checking is only done when
Vagrant must download the box.
If this is specified, then box_download_checksum_type
must also be
specified.
109 |
# File 'lib/config_builder/model/vm.rb', line 109 def_model_attribute :box_download_checksum |
#box_download_checksum_type ⇒ String
Returns The type of checksum specified by
box_download_checksum
(if any). Supported values are currently md5
,
sha1
, and sha256
.
115 |
# File 'lib/config_builder/model/vm.rb', line 115 def_model_attribute :box_download_checksum_type |
#box_download_client_cert ⇒ String
Returns Path to a client certificate to use when downloading the box, if it is necessary. By default, no client certificate is used to download the box.
121 |
# File 'lib/config_builder/model/vm.rb', line 121 def_model_attribute :box_download_client_cert |
#box_download_insecure ⇒ Boolean
Returns If true
, then SSL certificates from the server will
not be verified. By default, if the URL is an HTTPS URL, then SSL certs
will be verified.
127 |
# File 'lib/config_builder/model/vm.rb', line 127 def_model_attribute :box_download_insecure |
#box_url ⇒ String+
Returns The URL that the configured box can be
found at. If box
is a shorthand to a box in Vagrant Cloud then this
value doesn't need to be specified. Otherwise, it should point to the
proper place where the box can be found if it isn't installed.
This can also be an array of multiple URLs. The URLs will be tried in order. Note that any client certificates, insecure download settings, and so on will apply to all URLs in this list.
The URLs can also be local files by using the file:// scheme. For example: "file:///tmp/test.box".
98 |
# File 'lib/config_builder/model/vm.rb', line 98 def_model_attribute :box_url |
#box_version ⇒ String
Returns The version of the box to use. This defaults to ">= 0" (the latest version available). This can contain an arbitrary list of constraints, separated by commas, such as: >= 1.0, < 1.5. When constraints are given, Vagrant will use the latest available box satisfying these constraints.
143 |
# File 'lib/config_builder/model/vm.rb', line 143 def_model_attribute :box_version |
#communicator ⇒ String
commands to this box. Set to 'winrm' for Windows VMs.
156 |
# File 'lib/config_builder/model/vm.rb', line 156 def_model_attribute :communicator |
#forwarded_ports ⇒ Array<Hash<Symbol, Object>>
Returns A collection of port mappings.
52 |
# File 'lib/config_builder/model/vm.rb', line 52 def_model_delegator :forwarded_ports |
#guest ⇒ String
Returns The guest type to use for this VM.
78 |
# File 'lib/config_builder/model/vm.rb', line 78 def_model_attribute :guest |
#hostname ⇒ String
Returns The hostname the machine should have.
151 |
# File 'lib/config_builder/model/vm.rb', line 151 def_model_attribute :hostname |
#name ⇒ String
Returns The name of the instantiated box in this environment.
147 |
# File 'lib/config_builder/model/vm.rb', line 147 def_model_attribute :name |
#private_networks ⇒ Array<Hash<Symbol, Object>>
Returns A collection of IP address network settings.
63 |
# File 'lib/config_builder/model/vm.rb', line 63 def_model_delegator :private_networks |
#provider ⇒ Hash<Symbol, Object>
Returns The provider configuration for this VM.
16 |
# File 'lib/config_builder/model/vm.rb', line 16 def_model_delegator :provider |
#providers ⇒ Array<Hash{String, Symbol => Object}>
Returns A collection of provider parameters that should be applied to a VM.
27 |
# File 'lib/config_builder/model/vm.rb', line 27 def_model_delegator :providers |
#provisioners ⇒ Array<Hash<Symbol, Object>>
Returns A collection of provisioner parameters in the order that they should be applied of provisioner types, and a list of provisioner instances for each type.
42 |
# File 'lib/config_builder/model/vm.rb', line 42 def_model_delegator :provisioners |
#synced_folders ⇒ Array<Hash<Symbol, Object>>
74 |
# File 'lib/config_builder/model/vm.rb', line 74 def_model_delegator :synced_folders |
Instance Method Details
#to_proc ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/config_builder/model/vm.rb', line 168 def to_proc Proc.new do |global_config| global_config.vm.define(attr(:name)) do |config| vm_config = config.vm with_attr(:box) { |val| vm_config.box = val } with_attr(:box_url) { |val| vm_config.box_url = val } with_attr(:box_download_checksum) { |val| vm_config.box_download_checksum = val } with_attr(:box_download_checksum_type) { |val| vm_config.box_download_checksum_type = val } with_attr(:box_download_client_cert) { |val| vm_config.box_download_client_cert = val } with_attr(:box_download_insecure) { |val| vm_config.box_download_insecure = val } with_attr(:box_check_update) { |val| vm_config.box_check_update = val } with_attr(:box_version) { |val| vm_config.box_version = val } with_attr(:hostname) { |val| vm_config.hostname = attr(:hostname) } with_attr(:guest) { |val| vm_config.guest = attr(:guest) } with_attr(:communicator) { |val| vm_config.communicator = attr(:communicator) } eval_models(vm_config) end end end |