Merge branch 'CID-443-rollback_servers_with_failed_bootstrap' into qa

This commit is contained in:
Anton Chuchkalov 2016-03-08 10:11:47 +03:00
commit d204d64660
2 changed files with 13 additions and 4 deletions

View File

@ -265,8 +265,8 @@ module Devops
return error_code(:server_not_in_chef_nodes)
end
else
# @out << roll_back
# mongo.server_delete @server.id
roll_back
mongo.server_delete @server.id
msg = "Failed while bootstraping server with id '#{@server.id}'\n"
msg << "Bootstraping operation result was #{bootstrap_status}"
DevopsLogger.logger.error msg
@ -513,7 +513,7 @@ module Devops
def schedule_expiration
if @deploy_env.expires
@out << "Planning expiration in #{@deploy_env.expires}"
puts_and_flush "Planning expiration in #{@deploy_env.expires}"
ExpirationScheduler.new(@deploy_env.expires, @server).schedule_expiration!
end
end

View File

@ -366,10 +366,19 @@ RSpec.describe Devops::Executor::ServerExecutor, type: :executor, stubbed_connec
end
context "when bootstrap wasn't successful" do
it 'returns :server_bootstrap_fail error code' do
before do
allow(executor).to receive(:bootstrap) { 1 }
allow(executor).to receive(:roll_back)
end
it 'returns :server_bootstrap_fail error code' do
expect(two_phase_bootstrap).to eq 2
end
it 'rollbacks server' do
allow(executor).to receive(:roll_back)
two_phase_bootstrap
end
end
context 'when an error occured during bootstrap' do