Skip to content

Commit 059bf5f

Browse files
committed
stop using unsupported_reason_add
1 parent 8c56b60 commit 059bf5f

File tree

1 file changed

+19
-11
lines changed
  • app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager

1 file changed

+19
-11
lines changed

app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/vm.rb

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,33 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
66
supports(:console) { unsupported_reason(:native_console) }
77
supports :terminate
88
supports :reboot_guest do
9-
unsupported_reason_add(:reboot_guest, _("The VM is not powered on")) unless current_state == "on"
9+
_("The VM is not powered on") unless current_state == "on"
1010
end
1111
supports :reset do
12-
unsupported_reason_add(:reset, _("The VM is not powered on")) unless current_state == "on"
12+
_("The VM is not powered on") unless current_state == "on"
1313
end
1414
supports :snapshots
1515
supports :snapshot_create
1616
supports :revert_to_snapshot do
17-
unsupported_reason_add(:revert_to_snapshot, _("Cannot revert to snapshot while VM is running")) unless current_state == "off"
17+
_("Cannot revert to snapshot while VM is running") unless current_state == "off"
1818
end
1919
supports :remove_snapshot
2020
supports :remove_all_snapshots
2121

2222
supports_not :suspend
2323

2424
supports :publish do
25-
reason = _("Publish not supported because VM is blank") if blank?
26-
reason ||= _("Publish not supported because VM is orphaned") if orphaned?
27-
reason ||= _("Publish not supported because VM is archived") if archived?
28-
unsupported_reason_add(:publish, reason) if reason
25+
if blank?
26+
_("Publish not supported because VM is blank")
27+
elsif orphaned?
28+
_("Publish not supported because VM is orphaned")
29+
elsif archved?
30+
_("Publish not supported because VM is archived")
31+
end
2932
end
3033

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

4851
supports :resize do
49-
unsupported_reason_add(:resize, _('The VM is not powered off')) unless current_state == "off"
50-
unsupported_reason_add(:resize, _('The VM is not connected to a provider')) unless ext_management_system
51-
unsupported_reason_add(:resize, _('SAP VM resize not supported')) if flavor.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile)
52+
if current_state != "off"
53+
_('The VM is not powered off')
54+
elsif !ext_management_system
55+
_('The VM is not connected to a provider'))
56+
elsif flavor.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile)
57+
_('SAP VM resize not supported')
58+
end
5259
end
60+
supports :vnc_console
5361

5462
def cloud_instance_id
5563
ext_management_system.uid_ems

0 commit comments

Comments
 (0)