Class: Actions::ForemanWreckingball::Host::RemediateHardwareVersion
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::ForemanWreckingball::Host::RemediateHardwareVersion
- Defined in:
- app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb
Instance Method Summary collapse
- #append_error(message) ⇒ Object
- #delay(delay_options, host) ⇒ Object
- #humanized_input ⇒ Object
- #humanized_name ⇒ Object
- #plan(host) ⇒ Object
- #rescue_strategy ⇒ Object
- #run ⇒ Object
Instance Method Details
#append_error(message) ⇒ Object
52 53 54 55 |
# File 'app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb', line 52 def append_error() output[:errors] ||= [] output[:errors] << end |
#delay(delay_options, host) ⇒ Object
9 10 11 12 |
# File 'app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb', line 9 def delay(, host) action_subject(host) super(, host) end |
#humanized_input ⇒ Object
48 49 50 |
# File 'app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb', line 48 def humanized_input input[:host] && input[:host][:name] end |
#humanized_name ⇒ Object
44 45 46 |
# File 'app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb', line 44 def humanized_name _('Upgrade VM Hardware Version') end |
#plan(host) ⇒ Object
14 15 16 17 |
# File 'app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb', line 14 def plan(host) action_subject(host) plan_self end |
#rescue_strategy ⇒ Object
57 58 59 |
# File 'app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb', line 57 def rescue_strategy Dynflow::Action::Rescue::Skip end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/lib/actions/foreman_wreckingball/host/remediate_hardware_version.rb', line 19 def run host = ::Host.find(input[:host][:id]) output[:old_hardware_version] = host.vmware_facet.hardware_version initially_powered_on = host.power.ready? output[:initially_powered_on] = initially_powered_on vm = host.compute_object if initially_powered_on vm.stop vm.wait_for { power_state == 'poweredOff' } fail _('Could not shut down VM.') if vm.ready? end vm.vm_upgrade_hardware state = host.refresh_vmware_facet! output[:state] = state output[:new_hardware_version] = host.vmware_facet.hardware_version ensure vm.start if vm && initially_powered_on end |