Class: ConfigBuilder::Model::VM
- Defined in:
- lib/config_builder/model/vm.rb
Overview
Instance Attribute Summary collapse
- #allowed_synced_folder_types ⇒ Array<String>
-
#autostart ⇒ Fixnum
The time in seconds that Vagrant will wait for the machine to boot and be accessible.
-
#base_mac ⇒ String
MAC address of the NAT device.
-
#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_ca_cert ⇒ String
Path to a CA cert bundle to use when downloading a box directly.
-
#box_download_ca_path ⇒ String
Path to a directory containing CA certificates for downloading a box directly.
-
#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_download_location_trusted ⇒ Boolean
If ´true´, then all HTTP redirects will be treated as trusted.
- #box_server_url ⇒ String
-
#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.
-
#graceful_halt_timeout ⇒ Fixnum
The time in seconds that Vagrant will wait for the machine.
-
#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.
-
#post_up_message ⇒ String
A message to show after vagrant up.
-
#primary ⇒ Boolean
a specific machine in a multi-machine environment is not specified.
-
#private_networks ⇒ Array<Hash<Symbol, Object>>
A collection of IP address network settings.
-
#provider ⇒ Hash<Symbol, Object>
deprecated
Deprecated.
Use #providers instead.
-
#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.
-
#public_networks ⇒ Array<Hash<Symbol, Object>>
A collection of IP address network settings.
- #synced_folders ⇒ Array<Hash<Symbol, Object>>
-
#usable_port_range ⇒ String
A range of ports Vagrant can use for handling port collisions and such.
Instance Method Summary collapse
- #configure_usable_port_range(config, val) ⇒ Object
-
#initialize ⇒ VM
constructor
A new instance of VM.
- #to_proc ⇒ Object
Methods inherited from Base
#attr, #attrs=, #call, #configure!, def_model_attribute, def_model_delegator, def_model_id, def_model_option, #eval_models, #instance_id, #instance_options, model_attributes, model_delegators, #model_delegators, model_options, new_from_hash, #with_attr
Constructor Details
#initialize ⇒ VM
Returns a new instance of VM.
232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/config_builder/model/vm.rb', line 232 def initialize @defaults = { :providers => [], :provisioners => [], :forwarded_ports => [], :private_networks => [], :public_networks => [], :synced_folders => [], :autostart => true, } end |
Instance Attribute Details
#allowed_synced_folder_types ⇒ Array<String>
104 |
# File 'lib/config_builder/model/vm.rb', line 104 def_model_attribute :allowed_synced_folder_types |
#autostart ⇒ Fixnum
Returns The time in seconds that Vagrant will wait for the machine to boot and be accessible. By default this is 300 seconds.
94 |
# File 'lib/config_builder/model/vm.rb', line 94 def_model_option :autostart |
#base_mac ⇒ String
Returns MAC address of the NAT device.
108 |
# File 'lib/config_builder/model/vm.rb', line 108 def_model_attribute :base_mac |
#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.
119 |
# File 'lib/config_builder/model/vm.rb', line 119 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).
127 |
# File 'lib/config_builder/model/vm.rb', line 127 def_model_attribute :box_check_update |
#box_download_ca_cert ⇒ String
Returns Path to a CA cert bundle to use when downloading a box directly. By default, Vagrant will use the Mozilla CA cert bundle.
158 |
# File 'lib/config_builder/model/vm.rb', line 158 def_model_attribute :box_download_ca_cert |
#box_download_ca_path ⇒ String
Returns Path to a directory containing CA certificates for downloading a box directly. By default, Vagrant will use the Mozilla CA cert bundle.
164 |
# File 'lib/config_builder/model/vm.rb', line 164 def_model_attribute :box_download_ca_path |
#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.
175 |
# File 'lib/config_builder/model/vm.rb', line 175 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
.
181 |
# File 'lib/config_builder/model/vm.rb', line 181 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.
187 |
# File 'lib/config_builder/model/vm.rb', line 187 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.
193 |
# File 'lib/config_builder/model/vm.rb', line 193 def_model_attribute :box_download_insecure |
#box_download_location_trusted ⇒ Boolean
Returns If ´true´, then all HTTP redirects will be treated as trusted. That means credentials used for initial URL will be used for all subsequent redirects. By default, redirect locations are untrusted so credentials (if specified) used only for initial HTTP request.
200 |
# File 'lib/config_builder/model/vm.rb', line 200 def_model_attribute :box_download_location_trusted |
#box_server_url ⇒ String
145 |
# File 'lib/config_builder/model/vm.rb', line 145 def_model_attribute :box_server_url |
#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".
141 |
# File 'lib/config_builder/model/vm.rb', line 141 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.
153 |
# File 'lib/config_builder/model/vm.rb', line 153 def_model_attribute :box_version |
#communicator ⇒ String
commands to this box. Set to 'winrm' for Windows VMs.
205 |
# File 'lib/config_builder/model/vm.rb', line 205 def_model_attribute :communicator |
#forwarded_ports ⇒ Array<Hash<Symbol, Object>>
Returns A collection of port mappings.
51 |
# File 'lib/config_builder/model/vm.rb', line 51 def_model_delegator :forwarded_ports |
#graceful_halt_timeout ⇒ Fixnum
Returns The time in seconds that Vagrant will wait for the machine.
|
# File 'lib/config_builder/model/vm.rb', line 207
|
#guest ⇒ String
Returns The guest type to use for this VM.
215 |
# File 'lib/config_builder/model/vm.rb', line 215 def_model_attribute :guest |
#hostname ⇒ String
Returns The hostname the machine should have.
219 |
# File 'lib/config_builder/model/vm.rb', line 219 def_model_attribute :hostname |
#name ⇒ String
Returns The name of the instantiated box in this environment.
88 |
# File 'lib/config_builder/model/vm.rb', line 88 def_model_id :name |
#post_up_message ⇒ String
Returns A message to show after vagrant up. This will be shown to the user and is useful for containing instructions such as how to access various components of the development environment.
225 |
# File 'lib/config_builder/model/vm.rb', line 225 def_model_attribute :post_up_message |
#primary ⇒ Boolean
a specific machine in a multi-machine environment is not specified. If false, vagrant must be given the box name explicitly for some commands.
100 |
# File 'lib/config_builder/model/vm.rb', line 100 def_model_option :primary |
#private_networks ⇒ Array<Hash<Symbol, Object>>
Returns A collection of IP address network settings.
62 |
# File 'lib/config_builder/model/vm.rb', line 62 def_model_delegator :private_networks |
#provider ⇒ Hash<Symbol, Object>
Use #providers instead.
Returns The provider configuration for this VM.
15 |
# File 'lib/config_builder/model/vm.rb', line 15 def_model_delegator :provider |
#providers ⇒ Array<Hash{String, Symbol => Object}>
Returns A collection of provider parameters that should be applied to a VM.
26 |
# File 'lib/config_builder/model/vm.rb', line 26 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.
41 |
# File 'lib/config_builder/model/vm.rb', line 41 def_model_delegator :provisioners |
#public_networks ⇒ Array<Hash<Symbol, Object>>
Returns A collection of IP address network settings.
73 |
# File 'lib/config_builder/model/vm.rb', line 73 def_model_delegator :public_networks |
#synced_folders ⇒ Array<Hash<Symbol, Object>>
84 |
# File 'lib/config_builder/model/vm.rb', line 84 def_model_delegator :synced_folders |
#usable_port_range ⇒ String
Returns A range of ports Vagrant can use for handling port collisions and such. Defaults to 2200..2250.
230 |
# File 'lib/config_builder/model/vm.rb', line 230 def_model_attribute :usable_port_range |
Instance Method Details
#configure_usable_port_range(config, val) ⇒ Object
255 256 257 |
# File 'lib/config_builder/model/vm.rb', line 255 def configure_usable_port_range(config, val) config.usable_port_range = Range.new(*val.split('..').map(&:to_i)) end |
#to_proc ⇒ Object
244 245 246 247 248 249 250 251 |
# File 'lib/config_builder/model/vm.rb', line 244 def to_proc Proc.new do |config| vm_config = config.vm configure!(vm_config) eval_models(vm_config) end end |