Skip to content

Commit 8c56b60

Browse files
committed
convert console_supported? to supports
1 parent 0ddccb3 commit 8c56b60

File tree

1 file changed

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

1 file changed

+11
-10
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
22
include_concern 'Operations'
33

44
supports :capture
5+
# leverages the logic of native_console
6+
supports(:console) { unsupported_reason(:native_console) }
57
supports :terminate
68
supports :reboot_guest do
79
unsupported_reason_add(:reboot_guest, _("The VM is not powered on")) unless current_state == "on"
@@ -28,16 +30,19 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
2830

2931
supports :html5_console do
3032
reason = _("VM Console not supported because VM is not powered on") unless current_state == "on"
31-
reason ||= _("VM Console not supported because VM is orphaned") if orphaned?
32-
reason ||= _("VM Console not supported because VM is archived") if archived?
33-
unsupported_reason_add(:html5_console, reason) if reason
33+
_("VM Console not supported because VM is not powered on")
34+
else
35+
unsupported_reason(:native_console)
36+
end
3437
end
3538
supports :launch_html5_console
3639

3740
supports :native_console do
38-
reason ||= _("VM Console not supported because VM is orphaned") if orphaned?
39-
reason ||= _("VM Console not supported because VM is archived") if archived?
40-
unsupported_reason_add(:native_console, reason) if reason
41+
if orphaned?
42+
_("VM Console not supported because VM is orphaned")
43+
elsif archived?
44+
_("VM Console not supported because VM is archived")
45+
end
4146
end
4247

4348
supports :resize do
@@ -203,10 +208,6 @@ def self.calculate_power_state(raw_power_state)
203208
end
204209
end
205210

206-
def console_supported?(type)
207-
return true if type.upcase == 'VNC'
208-
end
209-
210211
def console_url
211212
crn = ERB::Util.url_encode(ext_management_system.pcloud_crn.values.join(":"))
212213
params = URI.encode_www_form(:paneId => "manageiq", :crn => crn)

0 commit comments

Comments
 (0)