Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] convert console_supported? to supports #446

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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