Skip to content

Commit

Permalink
Add source to retire request to parse in parse_prov_category in engine
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed May 6, 2019
1 parent 2891bc3 commit f579458
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/vm_retire_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ class VmRetireRequest < MiqRetireRequest
SOURCE_CLASS_NAME = 'Vm'.freeze
ACTIVE_STATES = %w(retired) + base_class::ACTIVE_STATES

default_value_for(:source_id) { |r| r.get_option(:src_ids) }
default_value_for :source_type, SOURCE_CLASS_NAME

def my_zone
vm = Vm.find_by(:id => options[:src_ids])
vm.nil? ? super : vm.my_zone
Expand Down
5 changes: 5 additions & 0 deletions spec/models/miq_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ def approvals
end
end

let(:vm_retire_request) { FactoryBot.create(:vm_retire_request, :requester => fred) }
it "retire_request has source" do
expect(vm_retire_request.source_type).not_to eq(nil)
end

context "retire request source classes" do
let(:vm_retire_request) { FactoryBot.create(:vm_retire_request, :requester => fred) }
let(:service_retire_request) { FactoryBot.create(:service_retire_request, :requester => fred) }
Expand Down

0 comments on commit f579458

Please sign in to comment.