Skip to content

Commit

Permalink
Remove unused Service::RetirementManagement.retire_service_resources …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
chessbyte committed Oct 17, 2019
1 parent 04efa94 commit 22531a2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
13 changes: 0 additions & 13 deletions app/models/service/retirement_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ def before_retirement
children.each(&:retire_now)
end

def retire_service_resources
# TODO: delete me per https://github.com/ManageIQ/manageiq/pull/16933#discussion_r175805070
return
direct_service_children.each(&:retire_service_resources)

service_resources.each do |sr|
if sr.resource.respond_to?(:retire_now)
$log.info("Retiring service resource for service: #{name} resource ID: #{sr.id}")
sr.resource.retire_now(retirement_requester)
end
end
end

def automate_retirement_entrypoint
r = service_template.resource_actions.detect { |ra| ra.action == 'Retirement' } unless service_template.nil?
state_machine_entry_point = r.try(:fqname)
Expand Down
29 changes: 0 additions & 29 deletions spec/models/service/retirement_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,6 @@
expect(@service.retires_on).to eq(options[:date])
end

it "#retire_service_resources" do
ems = FactoryBot.create(:ems_vmware, :zone => @server.zone)
vm = FactoryBot.create(:vm_vmware, :ems_id => ems.id)
@service << vm
expect(@service.service_resources.size).to eq(1)
expect(@service.service_resources.first.resource).to_not receive(:retire_now)
@service.retire_service_resources
end

it "#retire_service_resources should get service's retirement_requester" do
ems = FactoryBot.create(:ems_vmware, :zone => @server.zone)
vm = FactoryBot.create(:vm_vmware, :ems_id => ems.id)
userid = 'freddy'
@service.update(:retirement_requester => userid)
@service << vm
expect(@service.service_resources.size).to eq(1)
expect(@service.service_resources.first.resource).to_not receive(:retire_now).with(userid)
@service.retire_service_resources
end

it "#retire_service_resources should get service's nil retirement_requester" do
ems = FactoryBot.create(:ems_vmware, :zone => @server.zone)
vm = FactoryBot.create(:vm_vmware, :ems_id => ems.id)
@service << vm
expect(@service.service_resources.size).to eq(1)
expect(@service.service_resources.first.resource).to_not receive(:retire_now).with(nil)
@service.retire_service_resources
end

it "#finish_retirement" do
message = "Service: [#{@service.name}], Retires On: [#{Time.zone.now.strftime("%x %R %Z")}], has been retired"
expect(@service).to receive(:raise_audit_event).with("service_retired", message, nil)
Expand Down

0 comments on commit 22531a2

Please sign in to comment.