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 1, 2024
1 parent e0d3d0a commit 95a9ae6
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
include Operations

supports :capture
# leverages the logic of native_console
supports(:console) { unsupported_reason(:native_console) }
supports :vnc_console
supports :terminate
supports :reboot_guest do
_("The VM is not powered on") unless current_state == "on"
Expand All @@ -20,22 +23,21 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
supports_not :suspend

supports :publish do
return _("Publish not supported because VM is blank") if blank?
return _("Publish not supported because VM is orphaned") if orphaned?
return _("Publish not supported because VM is archived") if archived?
unsupported_reason(:action)
end

# TODO: converge these all into console and use unsupported_reason(:console) for all
supports :html5_console do
return _("VM Console not supported because VM is not powered on") unless current_state == "on"
return _("VM Console not supported because VM is orphaned") if orphaned?
return _("VM Console not supported because VM is archived") if archived?
if current_state != "on"
_("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
return _("VM Console not supported because VM is orphaned") if orphaned?
return _("VM Console not supported because VM is archived") if archived?
unsupported_reason(:action)
end

supports :resize do
Expand Down Expand Up @@ -201,10 +203,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 95a9ae6

Please sign in to comment.