#891: for testing 3

This commit is contained in:
amartynov 2015-11-17 16:21:28 +03:00
parent e4f7f387f3
commit ceacf07594
3 changed files with 31 additions and 31 deletions

View File

@ -59,10 +59,7 @@ module Connectors
set = {"status" => status, "updated_at" => Time.new}
set["job_result_code"] = job_result_code unless job_result_code.nil?
collection.update({"_id" => jid}, {"$set" => set})
end
def set_report_status(jid, status, job_result_code)
collection.update({"_id" => jid}, {"$set" => {"status" => status, "updated_at" => Time.new, "job_result_code" => job_result_code}})
DevopsLogger.logger.info("Report '#{jid}' status has been changed to '#{status}'")
end
def set_report_server_data id, chef_node_name, host

View File

@ -22,10 +22,6 @@ class StackBootstrapWorker < Worker
begin
stack = create_stack(stack_attrs)
rescue StackCreatingError
@out.puts "Stack creating error"
return 1
end
#TODO: errors
begin
@ -42,16 +38,20 @@ class StackBootstrapWorker < Worker
rescue BootstrapingStackServerError
@out.puts "\nAn error occured during bootstraping stack servers. Initiating stack rollback."
rollback_stack!(stack)
1
2
rescue DeployingStackServerError => e
@out.puts "\nStack was launched, but an error occured during deploying stack servers."
@out.puts "You can redeploy stack after fixing the error."
1
3
rescue StandardError => e
@out.puts "\nAn error occured. Initiating stack rollback."
rollback_stack!(stack)
raise e
end
rescue StackCreatingError
@out.puts "Stack creating error"
1
end
end
end

View File

@ -94,6 +94,7 @@ class Worker
out.puts "TODO: job_result: #{job_result}"
canonical_status = (job_result == 0 ? STATUS::COMPLETED : STATUS::FAILED)
out.puts "TODO: status: #{canonical_status}"
out.flush
DevopsLogger.logger.info "TODO: res: #{job_result} status: #{canonical_status}"
update_job_status(canonical_status, job_result)
rescue StandardError, RecordNotFound => e
@ -122,7 +123,7 @@ class Worker
end
def update_job_status(status, job_result_code)
set_status(jid, status)
Worker.set_status(jid, status)
mongo.set_report_status(jid, status, job_result_code)
status
end
@ -133,8 +134,10 @@ class Worker
config
end
=begin
def set_status id, status
self.class.set_status(id, status)
end
=end
end