Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
fix configure order calculation - bz1008609
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Chopra authored and danmcp committed Sep 17, 2013
1 parent f2d25b5 commit 76c72f6
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions controller/app/models/application.rb
Expand Up @@ -2670,9 +2670,18 @@ def calculate_configure_order(comp_specs)
configure_order.add_component_order(comp_spec[:prof].configure_order.map{|c| categories[c]}.flatten)
end

# enforce system order of components (web_framework first etc)
system_order = []
['web_framework','service','plugin'].each { |c| categories[c].each { |ci| system_order << ci if ci and not system_order.include?(ci) } }
configure_order.add_component_order(system_order)

#calculate configure order using tsort
if self.component_configure_order.empty?
computed_configure_order = configure_order.tsort
begin
computed_configure_order = configure_order.tsort
rescue Exception=>e
raise OpenShift::UserException.new("Conflict in calculating configure order. Cartridges should adhere to system's order ('web_framework','service','plugin').", 109)
end
else
computed_configure_order = self.component_configure_order.map{|c| categories[c]}.flatten
end
Expand Down Expand Up @@ -2717,16 +2726,30 @@ def calculate_component_orders
stop_order.add_component_order(comp_spec[:prof].stop_order.map{|c| categories[c]}.flatten)
end

# enforce system order of components (web_framework first etc)
system_order = []
['web_framework','service','plugin'].each { |c| categories[c].each { |ci| system_order << ci if ci and not system_order.include?(ci) } }
start_order.add_component_order(system_order)
stop_order.add_component_order(system_order.dup)

#calculate start order using tsort
if self.component_start_order.empty?
computed_start_order = start_order.tsort
begin
computed_start_order = start_order.tsort
rescue Exception=>e
raise OpenShift::UserException.new("Conflict in calculating start order. Cartridges should adhere to system's order ('web_framework','service','plugin').", 109)
end
else
computed_start_order = self.component_start_order.map{|c| categories[c]}.flatten
end

#calculate stop order using tsort
if self.component_stop_order.empty?
computed_stop_order = stop_order.tsort
begin
computed_stop_order = stop_order.tsort
rescue Exception=>e
raise OpenShift::UserException.new("Conflict in calculating start order. Cartridges should adhere to system's order ('web_framework','service','plugin').", 109)
end
else
computed_stop_order = self.component_stop_order.map{|c| categories[c]}.flatten
end
Expand Down

0 comments on commit 76c72f6

Please sign in to comment.