Skip to content

Commit

Permalink
Add method retire_now to container OrchestrationStack.
Browse files Browse the repository at this point in the history
So the container service may be retired.

https://bugzilla.redhat.com/show_bug.cgi?id=1564154
  • Loading branch information
lfu committed Apr 13, 2018
1 parent 0086f71 commit 1eb5531
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 @@ -74,4 +74,6 @@
factory :embedded_ansible_job, :class => "ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Job"

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

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 1eb5531

Please sign in to comment.