Project

General

Profile

Bug #35591

Updated by Adam Winberg over 1 year ago

Trying to get a fact value via API fails with: 

 <pre> 
 https://<foremanhost>/api/fact_values/?search=name=myfact+and+host=lxserv1638 
 { 
   "error": {"message":"Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."} 
 } 
 </pre> 

 production.log on Foreman server: 
 <pre> 
 2022-10-04T07:54:50 [I|app|4a5a7802] Started GET "/api/fact_values/?search=name=myfact+and+host=lxserv1638" "/api/fact_values/?search=name=smhi_vip+and+host=lxserv1638.smhi.se" for 10.65.1.80 at 2022-10-04 07:54:50 +0000 
 2022-10-04T07:54:50 [I|app|4a5a7802] Processing by Api::V2::FactValuesController#index as JSON 
 2022-10-04T07:54:50 [I|app|4a5a7802]     Parameters: {"search"=>"name=myfact {"search"=>"name=smhi_vip and host=lxserv1638", host=lxserv1638.smhi.se", "apiv"=>"v2"} 
 2022-10-04T07:54:50 [I|app|4a5a7802] Authorized user foremanread(foremanread) 
 2022-10-04T07:54:51 [W|app|4a5a7802] Action failed 
 2022-10-04T07:54:51 [I|app|4a5a7802] Backtrace for 'Action failed' error (ActiveModel::MissingAttributeError): missing attribute: fact_name_id 
  4a5a7802 | /usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute.rb:222:in `value' 
  4a5a7802 | /usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute_set/builder.rb:55:in `block in fetch_value' 
  4a5a7802 | /usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute_set/builder.rb:46:in `fetch' 
 ... 
 </pre> 

 If I turn on sql debugging and run the sql query written to the logs I get a correct response.  
 If I impersonate the user used to do the API request and do the same fact search in the GUI I get the correct response.  

 This has worked before, but not sure when it stopped working.  


Back