Skip to content

Commit

Permalink
Remove return from supports block
Browse files Browse the repository at this point in the history
Part of ManageIQ/manageiq#22898 (as a followup)

Introduced by ManageIQ#659

You can not have a return in a block. It causes a LongJump error
Besides, it tries to return from inside the calling block - not what we want.

Fixes a missed unsupported reason check
  • Loading branch information
kbrock committed Jul 1, 2024
1 parent c7ce32d commit ac2ee1a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/models/manageiq/providers/ovirt/infra_manager/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ def provider_object(connection = nil)
end

supports :enter_maint_mode do
return _('The Host is not connected to an active provider') unless has_active_ems?
return _('The Host is not powered on') unless power_state == 'on'
if !has_active_ems?
_('The Host is not connected to an active provider')
elsif power_state != 'on'
_('The Host is not powered on')
end
end

supports :exit_maint_mode do
_('The Host is not connected to an active provider') unless has_active_ems?
_('The Host is not in maintenance mode') unless power_state == 'maintenance'
if !has_active_ems?
_('The Host is not connected to an active provider')
elsif power_state != 'maintenance'
_('The Host is not in maintenance mode')
end
end

def enter_maint_mode
Expand Down

0 comments on commit ac2ee1a

Please sign in to comment.