From a092b0ad176b107f4cb1174c508e1aa83a9a10e1 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 16 Apr 2020 18:18:39 +0200 Subject: [PATCH] F #4532: Minor change case/when logic --- src/flow/oneflow-server.rb | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/flow/oneflow-server.rb b/src/flow/oneflow-server.rb index 6a7237aa66..a90354877c 100644 --- a/src/flow/oneflow-server.rb +++ b/src/flow/oneflow-server.rb @@ -296,23 +296,21 @@ post '/service/:id/action' do # OpenNebula::Error.new("Action #{action['perform']}: " \ # 'Only supported for append') # end - else - if Role::SCHEDULE_ACTIONS.include?(action['perform']) - # Use defaults only if one of the options is supplied - opts['period'] ||= conf[:action_period] - opts['number'] ||= conf[:action_number] + when *Role::SCHEDULE_ACTIONS + # Use defaults only if one of the options is supplied + opts['period'] ||= conf[:action_period] + opts['number'] ||= conf[:action_number] - rc = lcm.service_sched_action(@client, - params[:id], - action['perform'], - opts['period'], - opts['number'], - opts['args']) - else - rc = OpenNebula::Error.new( - "Action #{action['perform']} not supported" - ) - end + rc = lcm.service_sched_action(@client, + params[:id], + action['perform'], + opts['period'], + opts['number'], + opts['args']) + else + rc = OpenNebula::Error.new( + "Action #{action['perform']} not supported" + ) end if OpenNebula.is_error?(rc)