Skip to content

Commit

Permalink
stop using unsupported_reason_add
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Mar 8, 2023
1 parent 8c56b60 commit 1f6d25f
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,33 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
supports(:console) { unsupported_reason(:native_console) }
supports :terminate
supports :reboot_guest do
unsupported_reason_add(:reboot_guest, _("The VM is not powered on")) unless current_state == "on"
_("The VM is not powered on") unless current_state == "on"
end
supports :reset do
unsupported_reason_add(:reset, _("The VM is not powered on")) unless current_state == "on"
_("The VM is not powered on") unless current_state == "on"
end
supports :snapshots
supports :snapshot_create
supports :revert_to_snapshot do
unsupported_reason_add(:revert_to_snapshot, _("Cannot revert to snapshot while VM is running")) unless current_state == "off"
_("Cannot revert to snapshot while VM is running") unless current_state == "off"
end
supports :remove_snapshot
supports :remove_all_snapshots

supports_not :suspend

supports :publish do
reason = _("Publish not supported because VM is blank") if blank?
reason ||= _("Publish not supported because VM is orphaned") if orphaned?
reason ||= _("Publish not supported because VM is archived") if archived?
unsupported_reason_add(:publish, reason) if reason
if blank?
_("Publish not supported because VM is blank")
elsif orphaned?
_("Publish not supported because VM is orphaned")
elsif archved?
_("Publish not supported because VM is archived")
end
end

supports :html5_console do
reason = _("VM Console not supported because VM is not powered on") unless current_state == "on"
unless current_state == "on"
_("VM Console not supported because VM is not powered on")
else
unsupported_reason(:native_console)
Expand All @@ -46,10 +49,15 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
end

supports :resize do
unsupported_reason_add(:resize, _('The VM is not powered off')) unless current_state == "off"
unsupported_reason_add(:resize, _('The VM is not connected to a provider')) unless ext_management_system
unsupported_reason_add(:resize, _('SAP VM resize not supported')) if flavor.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile)
if current_state != "off"
_('The VM is not powered off')
elsif !ext_management_system
_('The VM is not connected to a provider')
elsif flavor.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile)
_('SAP VM resize not supported')
end
end
supports :vnc_console

def cloud_instance_id
ext_management_system.uid_ems
Expand Down

0 comments on commit 1f6d25f

Please sign in to comment.