#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 = {"status" => status, "updated_at" => Time.new}
set["job_result_code"] = job_result_code unless job_result_code.nil? set["job_result_code"] = job_result_code unless job_result_code.nil?
collection.update({"_id" => jid}, {"$set" => set}) collection.update({"_id" => jid}, {"$set" => set})
end DevopsLogger.logger.info("Report '#{jid}' status has been changed to '#{status}'")
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}})
end end
def set_report_server_data id, chef_node_name, host def set_report_server_data id, chef_node_name, host

View File

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

View File

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