diff --git a/app/models/vm/operations.rb b/app/models/vm/operations.rb index fe533ed4acc..2f1144717b5 100644 --- a/app/models/vm/operations.rb +++ b/app/models/vm/operations.rb @@ -6,18 +6,13 @@ module Vm::Operations include_concern 'Lifecycle' included do - supports :html5_console do - consup = %w[vnc webmks spice].any? { |type| send(:console_supported?, type) } - _("The web-based HTML5 Console is not supported") unless consup - end - - supports :vmrc_console do - _("VMRC Console not supported") unless console_supported?('VMRC') - end - - supports :native_console do - _("VM NATIVE Console not supported") unless console_supported?('NATIVE') - end + supports_not :console + supports_not :html5_console + supports_not :native_console + supports_not :spice_console + supports_not :vmrc_console + supports_not :vnc_console + supports_not :webmks_console supports :launch_html5_console do _("The web-based HTML5 Console is not available because the VM is not powered on") unless power_state == 'on' diff --git a/app/models/vm_or_template.rb b/app/models/vm_or_template.rb index 6017f6777ab..7c4f8c3779e 100644 --- a/app/models/vm_or_template.rb +++ b/app/models/vm_or_template.rb @@ -1608,10 +1608,6 @@ def add_ems_event(event_type, event_message, event_timestamp) EmsEvent.add(ems_id, event) end - def console_supported?(_type) - false - end - # Stop certain charts from showing unless the subclass allows def non_generic_charts_available? false @@ -1670,8 +1666,6 @@ def tenant_identity user end - supports(:console) { N_("Console not supported") unless console_supported?('spice') || console_supported?('vnc') } - def child_resources children end diff --git a/spec/models/vm/operations_spec.rb b/spec/models/vm/operations_spec.rb index cc9e9561ce9..4d8e6ee013e 100644 --- a/spec/models/vm/operations_spec.rb +++ b/spec/models/vm/operations_spec.rb @@ -53,49 +53,6 @@ end end - describe '#supports?(:vmrc_console)' do - it 'returns false if type is not supported' do - allow(@vm).to receive(:console_supported?).with('VMRC').and_return(false) - - expect(@vm.supports?(:vmrc_console)).to be_falsey - expect(@vm.unsupported_reason(:vmrc_console)).to include('VMRC Console not supported') - end - - it 'supports it if all conditions are met' do - allow(@vm).to receive(:console_supported?).with('VMRC').and_return(true) - - expect(@vm.supports?(:vmrc_console)).to be_truthy - end - end - - describe '#supports?(:html5_console)' do - it 'supports it if all conditions are met' do - allow(@vm).to receive(:console_supported?).and_return(true) - expect(@vm.supports?(:html5_console)).to be_truthy - end - - it 'returns false if type is not supported' do - allow(@vm).to receive(:console_supported?).and_return(false) - expect(@vm.supports?(:html5_console)).to be_falsey - expect(@vm.unsupported_reason(:html5_console)).to include('HTML5 Console is not supported') - end - end - - describe '#supports?(:native_console)' do - it 'returns false if type is not supported' do - allow(@vm).to receive(:console_supported?).with('NATIVE').and_return(false) - - expect(@vm.supports?(:native_console)).to be_falsey - expect(@vm.unsupported_reason(:native_console)).to include('NATIVE Console not supported') - end - - it 'supports it if all conditions are met' do - allow(@vm).to receive(:console_supported?).with('NATIVE').and_return(true) - - expect(@vm.supports?(:native_console)).to be_truthy - end - end - describe '#supports?(:launch_vmrc_console)' do it 'does not support it if validate_remote_console_vmrc_support raises an error' do allow(@vm).to receive(:validate_remote_console_vmrc_support).and_raise(StandardError)