Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove check for a state of initialized in 4 start_retirement methods. #331

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
exit MIQ_ABORT
end

unless stack.retirement_initialized?
$evm.log('error', "Stack has not been initialized for retirement. Aborting current State Machine.")
exit MIQ_ABORT
end

$evm.log('info', "Stack before start_retirement: #{stack.inspect} ")
$evm.create_notification(:type => :vm_retiring, :subject => stack)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def vm_validation
if @vm.retiring?
raise 'VM is already in the process of being retired'
end

unless @vm.retirement_initialized?
raise 'VM has not been initialized for retirement. Aborting current State Machine.'
end
end

def start_retirement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
exit MIQ_ABORT
end

unless vm.retirement_initialized?
$evm.log('error', "VM has not been initialized for retirement. Aborting current State Machine.")
exit MIQ_ABORT
end

$evm.log('info', "VM before start_retirement: #{vm.inspect} ")

$evm.create_notification(:type => :vm_retiring, :subject => vm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
exit MIQ_ABORT
end

unless service.retirement_initialized?
$evm.log('error', "Service has not been initialized for retirement. Aborting current State Machine.")
exit MIQ_ABORT
end

$evm.create_notification(:type => :service_retiring, :subject => service)
service.start_retirement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@
let(:method_name) { "StartRetirement" }

it "starts a retirement request" do
stack.update_attributes(:retirement_state => 'initializing')
ws
expect(OrchestrationStack.where(:id => stack.id).first.retirement_state).to eq('retiring')
end

it "aborts if not initialized" do
expect { ws }.to raise_error(MiqAeException::AbortInstantiation, 'Method exited with rc=MIQ_ABORT')
end

it "aborts if stack is already retired" do
stack.update_attributes(:retired => true)
expect { ws }.to raise_error(MiqAeException::AbortInstantiation, 'Method exited with rc=MIQ_ABORT')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
allow(ae_service).to receive(:create_notification)
expect(ae_service).to receive(:create_notification).with(:type => :vm_retiring, :subject => svc_vm)
expect(svc_vm).to receive(:start_retirement)
svc_vm.retirement_state = 'initializing'
expect { described_class.new(ae_service).main }.to_not raise_error
end
end