Skip to content

Commit

Permalink
Merge pull request #331 from billfitzgerald0120/retirement_remove_ini…
Browse files Browse the repository at this point in the history
…tialized

Remove check for a state of initialized in 4 start_retirement methods.
  • Loading branch information
gmcculloug committed Jun 15, 2018
2 parents 0d7b72a + b60d9c4 commit 42604ff
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 25 deletions.
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

0 comments on commit 42604ff

Please sign in to comment.