lib/percheron/actions/exec.rb in percheron-0.6.3 vs lib/percheron/actions/exec.rb in percheron-0.6.4

- old
+ new

@@ -10,23 +10,24 @@ @scripts = scripts @description = description end def execute! + results = [] $logger.debug "Executing #{description} scripts '#{scripts.inspect}' on '#{container.name}'" started_dependant_containers = start_containers!(dependant_containers) - execute_scripts_on_running_container! - stop_containers!(started_dependant_containers) - container + results << execute_scripts_on_running_container! + results << stop_containers!(started_dependant_containers) + results.compact.empty? ? nil : container end private attr_reader :container, :dependant_containers, :scripts, :description def execute_scripts_on_running_container! container_running = container.running? - Start.new(container).execute! unless container_running + Start.new(container, exec_scripts: false).execute! unless container_running execute_scripts! Stop.new(container).execute! unless container_running end def execute_scripts!