Using CloudForms to generate reports causes the exception "`load_missing_constant': Unable to autoload constant VM"
Issue
- Using CloudForms Management Engine 4.2 or higher, generating reports that use conditional filters fail with the exception
'load_missing_constant': Unable to autoload constant VMand a traceback similar to the following in theevm.log:
[----] E, [2017-12-05T17:28:31.335449 #14808:3e9130] ERROR -- : [LoadError]: Unable to autoload constant VM, expected /var/www/miq/vmdb/app/models/vm.rb to define it Method:[rescue in _async_generate_table]
[----] E, [2017-12-05T17:28:31.335702 #14808:3e9130] ERROR -- : /opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:512:in `load_missing_constant'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:203:in `const_missing'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/inflector/methods.rb:268:in `const_get'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/inflector/methods.rb:268:in `block in constantize'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/inflector/methods.rb:266:in `each'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/inflector/methods.rb:266:in `inject'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/inflector/methods.rb:266:in `constantize'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/inflector/methods.rb:311:in `safe_constantize'
/opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/core_ext/string/inflections.rb:77:in `safe_constantize'
/var/www/miq/vmdb/lib/miq_expression/field.rb:28:in `is_field?'
/var/www/miq/vmdb/lib/miq_expression.rb:995:in `quote'
/var/www/miq/vmdb/app/models/condition.rb:121:in `_subst'
/var/www/miq/vmdb/app/models/condition.rb:101:in `block in subst'
/var/www/miq/vmdb/app/models/condition.rb:101:in `gsub!'
/var/www/miq/vmdb/app/models/condition.rb:101:in `subst'
/var/www/miq/vmdb/app/models/condition.rb:85:in `subst_matches?'
/var/www/miq/vmdb/lib/miq_expression.rb:822:in `lenient_evaluate'
/var/www/miq/vmdb/lib/rbac/filterer.rb:622:in `matches_search_filters?'
/var/www/miq/vmdb/lib/rbac/filterer.rb:246:in `block in search'
/opt/rh/cfme-gemset/gems/activerecord-5.0.3/lib/active_record/relation/delegation.rb:40:in `each'
/opt/rh/cfme-gemset/gems/activerecord-5.0.3/lib/active_record/relation/delegation.rb:40:in `each'
/var/www/miq/vmdb/lib/rbac/filterer.rb:246:in `reject'
/var/www/miq/vmdb/lib/rbac.rb:3:in `search'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:304:in `_generate_table'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:188:in `block in generate_table'
/var/www/miq/vmdb/app/models/user.rb:245:in `with_user'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:188:in `generate_table'
/var/www/miq/vmdb/app/models/miq_report/generator/async.rb:96:in `_async_generate_table'
/var/www/miq/vmdb/app/models/miq_queue.rb:347:in `block in deliver'
- This issue requires that there be a service beginning with the exact characters "VM-" and that the service in question has at least one or more instances present.
- This issue requires that a conditional filter be specified in the report. Reports without filters are unaffected.
Environment
- CloudForms 4.2 or higher
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.