lib/floe/container_runner/docker.rb in floe-0.15.0 vs lib/floe/container_runner/docker.rb in floe-0.15.1
- old
+ new
@@ -28,11 +28,11 @@
if secrets && !secrets.empty?
runner_context["secrets_ref"] = create_secret(secrets)
end
begin
- runner_context["container_ref"] = run_container(image, env, execution_id, runner_context["secrets_ref"])
+ runner_context["container_ref"] = run_container(image, env, execution_id, runner_context["secrets_ref"], context.logger)
runner_context
rescue AwesomeSpawn::CommandResultError => err
cleanup(runner_context)
{"Error" => "States.TaskFailed", "Cause" => err.to_s}
end
@@ -121,11 +121,11 @@
private
attr_reader :network
- def run_container(image, env, execution_id, secrets_file)
+ def run_container(image, env, execution_id, secrets_file, logger)
params = run_container_params(image, env, execution_id, secrets_file)
logger.debug("Running #{AwesomeSpawn.build_command_line(self.class::DOCKER_COMMAND, params)}")
result = docker!(*params)
@@ -180,11 +180,11 @@
end
end
def inspect_container(container_id)
JSON.parse(docker!("inspect", container_id).output).first
- rescue
- nil
+ rescue AwesomeSpawn::CommandResultError => err
+ raise Floe::ExecutionError.new("Failed to get status for container #{container_id}: #{err}")
end
def delete_container(container_id)
docker!("rm", container_id)
rescue