Skip to content

Commit

Permalink
Merge pull request ManageIQ#16769 from tinaafitz/quota_mixin_service_…
Browse files Browse the repository at this point in the history
…template_fix

Fix check_quota(:active_provisions) for Service MiqRequest invalid service_template.
(cherry picked from commit 8aa881f)

https://bugzilla.redhat.com/show_bug.cgi?id=1534589
  • Loading branch information
gmcculloug authored and d-m-u committed Jun 6, 2018
1 parent 5b3b942 commit a19f09c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/mixins/miq_provision_quota_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def vm_quota_values(pr, result)
end

def service_quota_values(request, result)
return unless request.service_template
request.service_template.service_resources.each do |sr|
if request.service_template.service_type == 'composite'
bundle_quota_values(sr, result)
Expand Down
6 changes: 6 additions & 0 deletions spec/models/service_template_provision_request_quota_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ def create_service_bundle(user, items, options = {})
context "active_provisions_by_tenant," do
let(:quota_method) { :active_provisions_by_tenant }
it_behaves_like "check_quota"

it "invalid service_template does not raise error" do
requests = load_queue
requests.first.update_attributes(:service_template => nil)
expect { request.check_quota(quota_method) }.not_to raise_error
end
end

context "active_provisions_by_group," do
Expand Down

0 comments on commit a19f09c

Please sign in to comment.