diff --git a/crowbar_framework/app/models/service_object.rb b/crowbar_framework/app/models/service_object.rb index ae1dcdca05..159aa7ef07 100644 --- a/crowbar_framework/app/models/service_object.rb +++ b/crowbar_framework/app/models/service_object.rb @@ -1069,6 +1069,8 @@ def apply_role(role, inst, in_queue, bootstrap = false) proposal = Proposal.where(barclamp: @bc_name, name: inst).first save_proposal = false + nodes_previousbatch = nil + roles_previousbatch = nil # element_order is an Array where each item represents a batch of roles and # the batches must be applied sequentially in this order. element_order.each do |roles| @@ -1169,7 +1171,14 @@ def apply_role(role, inst, in_queue, bootstrap = false) end end # roles.each - batches << [roles, nodes_in_batch] unless nodes_in_batch.empty? + if nodes_previousbatch == nodes_in_batch && !roles_previousbatch.nil? + # roles_previousbatch is same as batches[-1][0] + roles_previousbatch << roles + else + roles_previousbatch = roles + nodes_previousbatch = nodes_in_batch + batches << [roles, nodes_in_batch] unless nodes_in_batch.empty? + end end Rails.logger.debug "batches: #{batches.inspect}"