Skip to content

Commit

Permalink
Merge pull request #17298 from lfu/service_container_retirement_1564154
Browse files Browse the repository at this point in the history
Add method retire_now to container OrchestrationStack.
(cherry picked from commit 05e85b1)

https://bugzilla.redhat.com/show_bug.cgi?id=1578398
  • Loading branch information
gmcculloug authored and simaishi committed May 15, 2018
1 parent d4c8c11 commit d460eb8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def self.status_class
"#{name}::Status".constantize
end

def retire_now(requester = nil)
update_attributes(:retirement_requester => requester)
finish_retirement
end

def raw_status
failed = resources.any? { |obj| obj.resource_status == 'failed' }
if failed
Expand Down
2 changes: 2 additions & 0 deletions spec/factories/orchestration_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@

factory :orchestration_stack_vmware_cloud, :parent => :orchestration_stack, :class => "ManageIQ::Providers::Vmware::CloudManager::OrchestrationStack" do
end

factory :orchestration_stack_container, :parent => :orchestration_stack, :class => "ManageIQ::Providers::ContainerManager::OrchestrationStack"
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe ManageIQ::Providers::ContainerManager::OrchestrationStack do
let(:stack) { FactoryGirl.create(:orchestration_stack_container) }

describe '#retire_now' do
it 'retires the orchestration stack' do
expect(stack).to receive(:finish_retirement).once
stack.retire_now
end
end
end

0 comments on commit d460eb8

Please sign in to comment.