lib/percheron/stack.rb in percheron-0.6.2 vs lib/percheron/stack.rb in percheron-0.6.3
- old
+ new
@@ -38,27 +38,28 @@
all
end
end
def stop!(container_names: [])
- container_names = dependant_containers(container_names).reverse
- serial_processor(container_names) { |container| Actions::Stop.new(container).execute! }
+ container_names = dependant_containers_for(container_names).reverse
+ exec_on_dependant_containers_for(container_names) { |container| Actions::Stop.new(container).execute! }
end
def start!(container_names: [])
- container_names = dependant_containers(container_names)
- serial_processor(container_names) { |container| Actions::Start.new(container, container.dependant_containers.values).execute! }
+ container_names = dependant_containers_for(container_names)
+ exec_on_dependant_containers_for(container_names) { |container| Actions::Start.new(container, container.dependant_containers.values).execute! }
+
end
def restart!(container_names: [])
- container_names = dependant_containers(container_names).reverse
- serial_processor(container_names) { |container| Actions::Restart.new(container).execute! }
+ container_names = dependant_containers_for(container_names)
+ exec_on_dependant_containers_for(container_names) { |container| Actions::Restart.new(container).execute! }
end
def create!(container_names: [])
- container_names = dependant_containers(container_names)
- serial_processor(container_names) { |container| Actions::Create.new(container).execute! }
+ container_names = dependant_containers_for(container_names)
+ exec_on_dependant_containers_for(container_names) { |container| Actions::Create.new(container).execute! }
end
def recreate!(container_names: [], force_recreate: false, delete: false)
current = container_names_final = filter_container_names(container_names)
@@ -67,17 +68,18 @@
current = deps = containers_affected(current).uniq
break if deps.empty?
container_names_final += deps
end
- serial_processor(container_names_final.uniq) do |container|
- Actions::Recreate.new(container, force_recreate: force_recreate, delete: delete).execute!
- end
+ exec_on_dependant_containers_for(container_names_final.uniq) { |container| Actions::Recreate.new(container, force_recreate: force_recreate, delete: delete).execute! }
end
def purge!
- serial_processor(filter_container_names) { |container| Actions::Purge.new(container).execute! }
+ serial_processor(filter_container_names) do |container|
+ Actions::Purge.new(container).execute!
+ $logger.info ''
+ end
end
def valid?
Validators::Stack.new(self).valid?
end
@@ -100,10 +102,17 @@
def exec_on_containers(container_names)
filter_containers(container_names).each { |_, container| yield(container) }
end
+ def exec_on_dependant_containers_for(container_names)
+ serial_processor(container_names) do |container|
+ yield(container)
+ $logger.info ''
+ end
+ end
+
def serial_processor(container_names)
exec_on_containers(container_names) do |container|
yield(container)
container_names.delete(container.name)
end
@@ -125,10 +134,10 @@
all[container_name] = all_containers[container_name].dependant_container_names
all
end
end
- def dependant_containers(container_names)
+ def dependant_containers_for(container_names)
container_names = filter_container_names(container_names)
wip_list = []
containers_and_their_dependants(container_names).each do |container_name, dependant_container_names|
wip_list += dependant_container_names unless dependant_container_names.empty?