CID-443: rollbacks servers with failed bootstrap
This commit is contained in:
parent
63b1a7fa84
commit
231c79ab48
@ -262,8 +262,8 @@ module Devops
|
|||||||
return error_code(:server_not_in_chef_nodes)
|
return error_code(:server_not_in_chef_nodes)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# @out << roll_back
|
roll_back
|
||||||
# mongo.server_delete @server.id
|
mongo.server_delete @server.id
|
||||||
msg = "Failed while bootstraping server with id '#{@server.id}'\n"
|
msg = "Failed while bootstraping server with id '#{@server.id}'\n"
|
||||||
msg << "Bootstraping operation result was #{bootstrap_status}"
|
msg << "Bootstraping operation result was #{bootstrap_status}"
|
||||||
DevopsLogger.logger.error msg
|
DevopsLogger.logger.error msg
|
||||||
@ -510,7 +510,7 @@ module Devops
|
|||||||
|
|
||||||
def schedule_expiration
|
def schedule_expiration
|
||||||
if @deploy_env.expires
|
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!
|
ExpirationScheduler.new(@deploy_env.expires, @server).schedule_expiration!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -366,10 +366,19 @@ RSpec.describe Devops::Executor::ServerExecutor, type: :executor, stubbed_connec
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when bootstrap wasn't successful" do
|
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(:bootstrap) { 1 }
|
||||||
|
allow(executor).to receive(:roll_back)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns :server_bootstrap_fail error code' do
|
||||||
expect(two_phase_bootstrap).to eq 2
|
expect(two_phase_bootstrap).to eq 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'rollbacks server' do
|
||||||
|
allow(executor).to receive(:roll_back)
|
||||||
|
two_phase_bootstrap
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when an error occured during bootstrap' do
|
context 'when an error occured during bootstrap' do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user