Class: VagrantPlugins::HyperV::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::HyperV::Config
- Defined in:
- lib/vagrant-windows-hyperv/monkey_patch/config.rb
Instance Attribute Summary collapse
-
#customizations ⇒ Object
readonly
Returns the value of attribute customizations.
-
#ip_address_timeout ⇒ Integer
The timeout to wait for an IP address when booting the machine, in seconds.
Instance Method Summary collapse
- #customize(*command) ⇒ Object
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
18 19 20 21 |
# File 'lib/vagrant-windows-hyperv/monkey_patch/config.rb', line 18 def initialize @ip_address_timeout = UNSET_VALUE @customizations = [] end |
Instance Attribute Details
#customizations ⇒ Object (readonly)
Returns the value of attribute customizations.
16 17 18 |
# File 'lib/vagrant-windows-hyperv/monkey_patch/config.rb', line 16 def customizations @customizations end |
#ip_address_timeout ⇒ Integer
The timeout to wait for an IP address when booting the machine, in seconds.
15 16 17 |
# File 'lib/vagrant-windows-hyperv/monkey_patch/config.rb', line 15 def ip_address_timeout @ip_address_timeout end |
Instance Method Details
#customize(*command) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/vagrant-windows-hyperv/monkey_patch/config.rb', line 23 def customize(*command) @customizations ||= [] event = command.first.is_a?(String) ? command.shift : "pre-boot" command = command[0] = command[1] @customizations << [event, command, ] end |
#finalize! ⇒ Object
31 32 33 34 35 |
# File 'lib/vagrant-windows-hyperv/monkey_patch/config.rb', line 31 def finalize! if @ip_address_timeout == UNSET_VALUE @ip_address_timeout = 120 end end |
#validate(machine) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/vagrant-windows-hyperv/monkey_patch/config.rb', line 37 def validate(machine) errors = _detected_errors valid_events = ["pre-boot"] @customizations.each do |event, _| if !valid_events.include?(event) errors << "Invalid custom event #{event} use pre-boot" end end { "Hyper-V" => errors } end |