#891: for testing 3
This commit is contained in:
parent
e4f7f387f3
commit
ceacf07594
@ -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
|
||||||
|
|||||||
@ -22,35 +22,35 @@ class StackBootstrapWorker < Worker
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
stack = create_stack(stack_attrs)
|
stack = create_stack(stack_attrs)
|
||||||
|
|
||||||
|
#TODO: errors
|
||||||
|
begin
|
||||||
|
servers_with_priority = persist_stack_servers!(stack)
|
||||||
|
unless without_bootstrap
|
||||||
|
sorted_keys = servers_with_priority.keys.sort{|x,y| y <=> x}
|
||||||
|
sorted_keys.each do |key|
|
||||||
|
@out.puts "Servers with priority '#{key}':"
|
||||||
|
bootstrap_servers!(servers_with_priority[key], report)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@out.puts "Done."
|
||||||
|
0
|
||||||
|
rescue BootstrapingStackServerError
|
||||||
|
@out.puts "\nAn error occured during bootstraping stack servers. Initiating stack rollback."
|
||||||
|
rollback_stack!(stack)
|
||||||
|
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."
|
||||||
|
3
|
||||||
|
rescue StandardError => e
|
||||||
|
@out.puts "\nAn error occured. Initiating stack rollback."
|
||||||
|
rollback_stack!(stack)
|
||||||
|
raise e
|
||||||
|
end
|
||||||
rescue StackCreatingError
|
rescue StackCreatingError
|
||||||
@out.puts "Stack creating error"
|
@out.puts "Stack creating error"
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
#TODO: errors
|
|
||||||
begin
|
|
||||||
servers_with_priority = persist_stack_servers!(stack)
|
|
||||||
unless without_bootstrap
|
|
||||||
sorted_keys = servers_with_priority.keys.sort{|x,y| y <=> x}
|
|
||||||
sorted_keys.each do |key|
|
|
||||||
@out.puts "Servers with priority '#{key}':"
|
|
||||||
bootstrap_servers!(servers_with_priority[key], report)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@out.puts "Done."
|
|
||||||
0
|
|
||||||
rescue BootstrapingStackServerError
|
|
||||||
@out.puts "\nAn error occured during bootstraping stack servers. Initiating stack rollback."
|
|
||||||
rollback_stack!(stack)
|
|
||||||
1
|
1
|
||||||
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
|
|
||||||
rescue StandardError => e
|
|
||||||
@out.puts "\nAn error occured. Initiating stack rollback."
|
|
||||||
rollback_stack!(stack)
|
|
||||||
raise e
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user