Bug #38509
openGetting "uninitialized constant Fog::Vsphere::Compute::ResourcePool" error
Description
Description of problem:
Getting the following error when calling the vshphere compute resource API.
# curl -H "Accept: application/json" -u "username:password" -v https://satellite.example.com/api/v2/compute_resources/1 | jq { "error": { "message": "uninitialized constant Fog::Vsphere::Compute::ResourcePool" }
How reproducible:
Easy
Is this issue a regression from an earlier version:
No. The issue is there for some years, but never found the root cause or fully fixed.
For more information please refer to the links below:
https://github.com/theforeman/foreman/pull/6803
https://github.com/fog/fog-vsphere/pull/267
Steps to Reproduce:
1. Create a compute resource connect to a Vcenter and enable caching.
2. Create and save a compute profile for it and fill in everything, especially the cluster and resources field.
3. Call the compute resource show API above to make sure we cached the data.
4. Restart foreman service "systemctl restart foreman"
5. Run the API call above again.
Actual behavior:
uninitialized constant Fog::Vsphere::Compute::ResourcePool
Expected behavior:
no error
Business Impact / Additional info:
Satellite loads the Fog classes on demand when API is called to the Vcenter. If Satellite is not yet call to the API since the last restart, then we will get the error loading the cached data.
2025-06-18T23:28:04 [I|app|01561ad5] Started GET "/api/v2/compute_resources/1" for XX.XX.XX.XX at 2025-06-18 23:28:04 -0600 2025-06-18T23:28:04 [I|app|01561ad5] Katello event daemon started process=271485 2025-06-18T23:28:04 [I|app|01561ad5] Subscribed to katello.candlepin.candlepin_events 2025-06-18T23:28:04 [I|app|01561ad5] Processing by Api::V2::ComputeResourcesController#show as JSON 2025-06-18T23:28:04 [I|app|01561ad5] Parameters: {"apiv"=>"v2", "id"=>"1"} 2025-06-18T23:28:04 [I|kat|01561ad5] Polling Katello Event Queue ... 2025-06-18T23:28:04 [D|app|01561ad5] Rendering api/v2/compute_resources/show.json.rabl ... 2025-06-18T23:28:04 [I|app|01561ad5] Rendered api/v2/compute_resources/show.json.rabl (Duration: 27.5ms | Allocations: 14722) 2025-06-18T23:28:04 [W|app|01561ad5] Action failed 2025-06-18T23:28:04 [I|app|01561ad5] Backtrace for 'Action failed' error (ActionView::Template::Error): uninitialized constant Fog::Vsphere::Compute::ResourcePool 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/inflector/methods.rb:287:in `const_get' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/inflector/methods.rb:287:in `block in constantize' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/inflector/methods.rb:283:in `each' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/inflector/methods.rb:283:in `inject' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/inflector/methods.rb:283:in `constantize' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/core_ext/string/inflections.rb:74:in `constantize' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/core_ext/marshal.rb:12:in `rescue in load' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/core_ext/marshal.rb:7:in `load' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache.rb:598:in `deserialize_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/redis_cache_store.rb:459:in `deserialize_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/redis_cache_store.rb:349:in `block in read_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/redis_cache_store.rb:478:in `failsafe' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/redis_cache_store.rb:347:in `read_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache.rb:136:in `block in read_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache.rb:78:in `block in fetch_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache.rb:78:in `fetch' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache.rb:78:in `fetch_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache.rb:134:in `read_entry' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache.rb:367:in `block in read' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache.rb:726:in `block in instrument' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:205:in `instrument' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache.rb:726:in `instrument' 01561ad5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache.rb:366:in `read' 01561ad5 | /usr/share/foreman/app/services/compute_resource_cache.rb:34:in `read' 01561ad5 | /usr/share/foreman/app/services/compute_resource_cache.rb:19:in `cache' 01561ad5 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:157:in `resource_pools' 01561ad5 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:721:in `normalize_vm_attrs' 01561ad5 | /usr/share/foreman/app/models/compute_attribute.rb:37:in `normalized_vm_attrs' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/helpers.rb:16:in `data_object_attribute' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:145:in `attribute' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:116:in `block in compile_settings' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:115:in `each' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:115:in `compile_settings' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:55:in `block in to_hash' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:253:in `cache_results' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:51:in `to_hash' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/engine.rb:91:in `to_hash' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/engine.rb:51:in `block in render' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/engine.rb:392:in `cache_results' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/engine.rb:50:in `render' 01561ad5 | /usr/share/foreman/config/initializers/rabl_init.rb:48:in `render' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:129:in `block in merge_engines_into_result' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:121:in `each' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:121:in `merge_engines_into_result' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:57:in `block in to_hash' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:253:in `cache_results' 01561ad5 | /usr/share/gems/gems/rabl-0.16.1/lib/rabl/builder.rb:51:in `to_hash'
Updated by The Foreman Bot 8 days ago
- Status changed from New to Ready For Testing
- Assignee set to Hao Yu
- Pull request https://github.com/theforeman/foreman/pull/10578 added