diff --git a/app/models/mixins/miq_provision_quota_mixin.rb b/app/models/mixins/miq_provision_quota_mixin.rb index 267969ecabf..f64f06a22a1 100644 --- a/app/models/mixins/miq_provision_quota_mixin.rb +++ b/app/models/mixins/miq_provision_quota_mixin.rb @@ -319,6 +319,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) diff --git a/spec/models/service_template_provision_request_quota_spec.rb b/spec/models/service_template_provision_request_quota_spec.rb index 77b8894658d..9674e03c991 100644 --- a/spec/models/service_template_provision_request_quota_spec.rb +++ b/spec/models/service_template_provision_request_quota_spec.rb @@ -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