Bug 1509977 - [Regression] Quota check for users errors out with "no implicit conversion of nil into String" for service provisioning
Summary: [Regression] Quota check for users errors out with "no implicit conversion of...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.10.0
Assignee: William Fitzgerald
QA Contact: Anurag
URL:
Whiteboard:
: 1516683 (view as bug list)
Depends On:
Blocks: 1530644 1531161
TreeView+ depends on / blocked
 
Reported: 2017-11-06 13:54 UTC by Aziza Karol
Modified: 2018-06-21 20:19 UTC (History)
10 users (show)

Fixed In Version: 5.10.0.0
Doc Type: Enhancement
Doc Text:
Clone Of:
: 1530644 1531161 (view as bug list)
Environment:
Last Closed: 2018-06-21 20:19:58 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Aziza Karol 2017-11-06 13:54:10 UTC
Description of problem:


Version-Release number of selected component (if applicable):
5.9.0.4

How reproducible:
100%

Steps to Reproduce:
1.Enable quota for users
2.Provision a service.
3.

Actual results:
"ERROR -- : MiqAeServiceModelBase.ar_method raised: <TypeError>: <no implicit conversion of nil into String>"  displayed in automation.log

Expected results:


Additional info:
Automation.log
----] I, [2017-11-06T08:33:29.444376 #55243:d0d130]  INFO -- : Q-task_id([service_template_provision_request_3]) Updated namespace [System/CommonMethods/QuotaMethods/used  ManageIQ/System/CommonMethods]
[----] I, [2017-11-06T08:33:29.452867 #55243:d0d130]  INFO -- : Q-task_id([service_template_provision_request_3]) Invoking [inline] method [/ManageIQ/System/CommonMethods/QuotaMethods/used] with inputs [{}]
[----] I, [2017-11-06T08:33:29.454409 #55243:d0d130]  INFO -- : Q-task_id([service_template_provision_request_3]) <AEMethod [/ManageIQ/System/CommonMethods/QuotaMethods/used]> Starting 
[----] I, [2017-11-06T08:33:30.771338 #55243:41d6560]  INFO -- : <AEMethod used> Quota Used: {:cpu=>0, :memory=>0, :vms=>0, :storage=>0, :provisioned_storage=>0}
[----] E, [2017-11-06T08:33:30.800221 #55243:41d6560] ERROR -- : The following error occurred during instance method <check_quota> for AR object <#<ServiceTemplateProvisionRequest id: 3, description: "Provisioning Service [provision_ec2] from [provisi...", approval_state: "approved", type: "ServiceTemplateProvisionRequest", created_on: "2017-11-06 13:33:15", updated_on: "2017-11-06 13:33:24", fulfilled_on: nil, requester_id: 1, requester_name: "Administrator", request_type: "clone_to_service", request_state: "pending", message: "Service_Template_Provisioning - Request Created", status: "Ok", options: {:dialog=>{"dialog_ele"=>"def"}, :workflow_settings=>{:resource_action_id=>45, :dialog_id=>35}, :initiator=>nil, :src_id=>2, :cart_state=>"ordered", :requester_group=>"EvmGroup-super_administrator"}, userid: "admin", source_id: 2, source_type: "ServiceTemplate", destination_id: nil, destination_type: nil, tenant_id: 2, service_order_id: 2, process: true>>
[----] E, [2017-11-06T08:33:30.800414 #55243:41d6560] ERROR -- : MiqAeServiceModelBase.ar_method raised: <TypeError>: <no implicit conversion of nil into String>
[----] E, [2017-11-06T08:33:30.800468 #55243:41d6560] ERROR -- : /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `casecmp'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `block in quota_find_active_prov_request_by_owner'
/opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/delegation.rb:38:in `each'
/opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/delegation.rb:38:in `each'
/opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/query_methods.rb:272:in `select'
/opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/query_methods.rb:272:in `select'
/var/www/miq/vmdb/lib/extensions/ar_virtual.rb:714:in `select'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `quota_find_active_prov_request_by_owner'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:349:in `quota_provision_stats'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:80:in `quota_active_provisions_by_owner'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:12:in `check_quota'
/opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:313:in `public_send'
/opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:313:in `block in object_send'
/opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:332:in `ar_method'
/opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:342:in `ar_method'
/opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:311:in `object_send'
/opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb:42:in `check_quota'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1624:in `perform_without_block'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1584:in `perform'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1657:in `block (2 levels) in main_loop'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `loop'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `block in main_loop'
[----] E, [2017-11-06T08:33:30.803313 #55243:821fe8c] ERROR -- : <AEMethod used> The following error occurred during method evaluation:
[----] E, [2017-11-06T08:33:30.803885 #55243:821fe8c] ERROR -- : <AEMethod used>   TypeError: no implicit conversion of nil into String
[----] E, [2017-11-06T08:33:30.805024 #55243:821fe8c] ERROR -- : <AEMethod used>   (druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `casecmp'
(druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `block in quota_find_active_prov_request_by_owner'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/delegation.rb:38:in `each'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/delegation.rb:38:in `each'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/query_methods.rb:272:in `select'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/query_methods.rb:272:in `select'
(druby://127.0.0.1:35506) /var/www/miq/vmdb/lib/extensions/ar_virtual.rb:714:in `select'
(druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `quota_find_active_prov_request_by_owner'
(druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:349:in `quota_provision_stats'
(druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:80:in `quota_active_provisions_by_owner'
(druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:12:in `check_quota'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:313:in `public_send'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:313:in `block in object_send'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:332:in `ar_method'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:342:in `ar_method'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:311:in `object_send'
(druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb:42:in `check_quota'
(druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1624:in `perform_without_block'
(druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1584:in `perform'
(druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1657:in `block (2 levels) in main_loop'
(druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `loop'
(druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `block in main_loop'
/ManageIQ/System/CommonMethods/QuotaMethods/used:54:in `active_provision_counts'
/ManageIQ/System/CommonMethods/QuotaMethods/used:26:in `used'
/ManageIQ/System/CommonMethods/QuotaMethods/used:17:in `main'
[----] E, [2017-11-06T08:33:30.808874 #55243:821fe8c] ERROR -- : Method STDERR: (druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `casecmp': no implicit conversion of nil into String (TypeError)
[----] E, [2017-11-06T08:33:30.809317 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `block in quota_find_active_prov_request_by_owner'
[----] E, [2017-11-06T08:33:30.810036 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/delegation.rb:38:in `each'
[----] E, [2017-11-06T08:33:30.810484 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/delegation.rb:38:in `each'
[----] E, [2017-11-06T08:33:30.810865 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/query_methods.rb:272:in `select'
[----] E, [2017-11-06T08:33:30.811321 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/relation/query_methods.rb:272:in `select'
[----] E, [2017-11-06T08:33:30.811721 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /var/www/miq/vmdb/lib/extensions/ar_virtual.rb:714:in `select'
[----] E, [2017-11-06T08:33:30.812169 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:256:in `quota_find_active_prov_request_by_owner'
[----] E, [2017-11-06T08:33:30.812605 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:349:in `quota_provision_stats'
[----] E, [2017-11-06T08:33:30.813064 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:80:in `quota_active_provisions_by_owner'
[----] E, [2017-11-06T08:33:30.813495 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:12:in `check_quota'
[----] E, [2017-11-06T08:33:30.813843 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:313:in `public_send'
[----] E, [2017-11-06T08:33:30.814291 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:313:in `block in object_send'
[----] E, [2017-11-06T08:33:30.814723 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:332:in `ar_method'
[----] E, [2017-11-06T08:33:30.815093 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:342:in `ar_method'
[----] E, [2017-11-06T08:33:30.815479 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:311:in `object_send'
[----] E, [2017-11-06T08:33:30.815881 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/cfme-gemset/bundler/gems/manageiq-automation_engine-1ab57c112903/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb:42:in `check_quota'
[----] E, [2017-11-06T08:33:30.816542 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1624:in `perform_without_block'
[----] E, [2017-11-06T08:33:30.816920 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1584:in `perform'
[----] E, [2017-11-06T08:33:30.817279 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1657:in `block (2 levels) in main_loop'
[----] E, [2017-11-06T08:33:30.817816 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `loop'
[----] E, [2017-11-06T08:33:30.818242 #55243:821fe8c] ERROR -- : Method STDERR: 	from (druby://127.0.0.1:35506) /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `block in main_loop'
[----] E, [2017-11-06T08:33:30.818632 #55243:821fe8c] ERROR -- : Method STDERR: 	from /ManageIQ/System/CommonMethods/QuotaMethods/used:54:in `active_provision_counts'
[----] E, [2017-11-06T08:33:30.819096 #55243:821fe8c] ERROR -- : Method STDERR: 	from /ManageIQ/System/CommonMethods/QuotaMethods/used:26:in `used'
[----] E, [2017-11-06T08:33:30.819488 #55243:821fe8c] ERROR -- : Method STDERR: 	from /ManageIQ/System/CommonMethods/QuotaMethods/used:17:in `main'
[----] E, [2017-11-06T08:33:30.819882 #55243:821fe8c] ERROR -- : Method STDERR: 	from /ManageIQ/System/CommonMethods/QuotaMethods/used:74:in `<main>'
[----] I, [2017-11-06T08:33:30.838848 #55243:d0d130]  INFO -- : Q-task_id([service_template_provision_request_3]) <AEMethod [/ManageIQ/System/CommonMethods/QuotaMethods/used]> Ending
[----] E, [2017-11-06T08:33:30.839219 #55243:d0d130] ERROR -- : Q-task_id([service_template_provision_request_3]) Aborting instantiation (unknown method return code) because [Method exited with rc=Unknown RC: [1]]
[----] E, [2017-11-06T08:33:30.839520 #55243:d0d130] ERROR -- : Q-task_id([service_template_provision_request_3]) State=<used> running  raised exception: <Method exited with rc=Unknown RC: [1]>
[----] W, [2017-11-06T08:33:30.839606 #55243:d0d130]  WARN -- : Q-task_id([service_template_provision_request_3]) Error in State=[used]
[----] I, [2017-11-06T08:33:30.839832 #55243:d0d130]  INFO -- : Q-task_id([service_template_provision_request_3]) Followed  Relationship [miqaedb:/System/CommonMethods/QuotaStatemachine/quota#create]
[----] I, [2017-11-06T08:33:30.840254 #55243:d0d130]  INFO -- : Q-task_id([service_template_provision_request_3]) Followed  Relationship [miqaedb:/System/Policy/ServiceTemplateProvisionRequest_starting#create]
[----] I, [2017-11-06T08:33:30.840564 #55243:d0d130]  INFO -- : Q-task_id([service_template_provision_request_3]) Followed  Relationship [miqaedb:/System/Policy/request_starting#create]

Comment 3 William Fitzgerald 2017-11-07 22:47:43 UTC
Aziza,

I was able to fix the problem on your appliance.   I will be creating a PR shortly.

Thanks

Billy

Comment 5 Tina Fitzgerald 2017-11-27 18:08:16 UTC
*** Bug 1516683 has been marked as a duplicate of this bug. ***

Comment 6 Tina Fitzgerald 2017-11-27 18:22:12 UTC
Another ticket opened with same error:
https://bugzilla.redhat.com/show_bug.cgi?id=1516683
(Closed ticket as duplicate)

As Greg mentioned, the workaround is to add an email address to the user record for the admin account. This error would not occur if tenant or group was used as the quota source.

Comment 9 CFME Bot 2017-12-20 01:42:52 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/faa9ad4b6c79752bbf5849ffa462b1c31e6c354f

commit faa9ad4b6c79752bbf5849ffa462b1c31e6c354f
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Tue Dec 19 16:30:23 2017 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Tue Dec 19 16:30:23 2017 -0500

    Call request_owner_email method to handle getting email for Services and
    VM provisions. Removed to_s from get_option(:owner_email) to cause an
    error if email is nil.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1509977

 app/models/mixins/miq_provision_quota_mixin.rb               | 5 ++---
 spec/models/miq_provision_request_spec.rb                    | 6 ++++++
 spec/models/service_template_provision_request_quota_spec.rb | 6 ++++++
 3 files changed, 14 insertions(+), 3 deletions(-)

Comment 10 CFME Bot 2017-12-20 14:28:28 UTC
New commit detected on ManageIQ/manageiq-content/master:
https://github.com/ManageIQ/manageiq-content/commit/784d6664294a609afe0514d5105543e07ec5a244

commit 784d6664294a609afe0514d5105543e07ec5a244
Author:     william fitzgerald <wfitzger>
AuthorDate: Fri Dec 15 15:20:31 2017 -0500
Commit:     william fitzgerald <wfitzger>
CommitDate: Tue Dec 19 18:13:52 2017 -0500

    Check for both owner email and requester email for user quota.
    
    Changed used method to check for owner email or requester email when quota is set to user.
    Previously the method was only looking for owner_email and when that wasn't available we encountered an error.
    
    The method now will raise an error if both are not found.  If you are running a service provision which doesn't allow a requester email
    and the user doesn't have an email address, we will raise this error:
    
    ERROR - Owner email not specified for User Quota
    
    Added tests for all possible email values for user quota.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1509977

 .../QuotaMethods.class/__methods__/used.rb         | 32 +++++++++----
 .../QuotaMethods.class/__methods__/used_spec.rb    | 54 ++++++++++++++++++++--
 2 files changed, 75 insertions(+), 11 deletions(-)


Note You need to log in before you can comment on or make changes to this bug.