Skip to content

Commit

Permalink
convert console_supported? to supports
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Mar 8, 2023
1 parent 0ddccb3 commit 8c56b60
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
include_concern 'Operations'

supports :capture
# leverages the logic of native_console
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"
Expand All @@ -28,16 +30,19 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man

supports :html5_console do
reason = _("VM Console not supported because VM is not powered on") unless current_state == "on"
reason ||= _("VM Console not supported because VM is orphaned") if orphaned?
reason ||= _("VM Console not supported because VM is archived") if archived?
unsupported_reason_add(:html5_console, reason) if reason
_("VM Console not supported because VM is not powered on")
else
unsupported_reason(:native_console)
end
end
supports :launch_html5_console

supports :native_console do
reason ||= _("VM Console not supported because VM is orphaned") if orphaned?
reason ||= _("VM Console not supported because VM is archived") if archived?
unsupported_reason_add(:native_console, reason) if reason
if orphaned?
_("VM Console not supported because VM is orphaned")
elsif archived?
_("VM Console not supported because VM is archived")
end
end

supports :resize do
Expand Down Expand Up @@ -203,10 +208,6 @@ def self.calculate_power_state(raw_power_state)
end
end

def console_supported?(type)
return true if type.upcase == 'VNC'
end

def console_url
crn = ERB::Util.url_encode(ext_management_system.pcloud_crn.values.join(":"))
params = URI.encode_www_form(:paneId => "manageiq", :crn => crn)
Expand Down

0 comments on commit 8c56b60

Please sign in to comment.