Class: VagrantPlugins::Skytap::Action::UpdateHardware
- Defined in:
- lib/vagrant-skytap/action/update_hardware.rb
Overview
This action reads the SSH info for the machine and puts it into the ‘:machine_ssh_info` key in the environment.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ UpdateHardware
constructor
A new instance of UpdateHardware.
Constructor Details
#initialize(app, env) ⇒ UpdateHardware
Returns a new instance of UpdateHardware.
11 12 13 14 |
# File 'lib/vagrant-skytap/action/update_hardware.rb', line 11 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_skytap::action::update_hardware") end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-skytap/action/update_hardware.rb', line 16 def call(env) if vm = env[:environment].current_vm provider_config = vm.machine.provider_config hardware_info = { cpus: provider_config.cpus, cpus_per_socket: provider_config.cpuspersocket, ram: provider_config.ram, guestOS: provider_config.guestos, }.reject{|k, v| v.nil? || v == vm.hardware[k.to_s]} if hardware_info.present? @logger.info("Updating hardware properties: #{hardware_info}") vm.update_with_retry(hardware: hardware_info) end end @app.call(env) end |