Bug #27556
closedUploading facts when host is in build mode does log error at info or higher
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1731861
Description of problem:
I had a problem to get facts uploaded in satellite. The request was not completed, but there is no reason written what is wrong.
---------
[crash/LI] root@li-lc-2224:~# grep 4403a209 /var/log/foreman/production.log
2019-07-22T08:18:04 [I|app|4403a209] Processing by Api::V2::HostsController#facts as JSON
2019-07-22T08:18:04 [I|app|4403a209] Parameters: {"facts"=>"[FILTERED]", "name"=>"li-lc-1681.hag.hilti.com", "certname"=>"li-lc-1681.hag.hilti.com", "apiv"=>"v2", "host"=>{"certname"=>"li-lc-1681.hag.hilti.com", "name"=>"li-lc-1681.hag.hilti.com"}}
2019-07-22T08:18:04 [I|app|4403a209] Completed 422 Unprocessable Entity in 23ms (Views: 0.3ms | ActiveRecord: 3.2ms)
-----------
Only when i enabled debug logging i was able to find the root cause (the system was in build mode and then it is not allowed):
---------
[crash/LI] root@li-lc-2224:~# grep 2fead00e /var/log/foreman/production.log
2019-07-22T08:22:46 [I|app|2fead00e] Processing by Api::V2::HostsController#facts as JSON
2019-07-22T08:22:46 [I|app|2fead00e] Parameters: {"facts"=>"[FILTERED]", "name"=>"li-lc-1681.hag.hilti.com", "certname"=>"li-lc-1681.hag.hilti.com", "apiv"=>"v2", "host"=>{"certname"=>"li-lc-1681.hag.hilti.com", "name"=>"li-lc-1681.hag.hilti.com"}}
2019-07-22T08:22:46 [D|app|2fead00e] Importer Katello::RhsmFactImporter does not implement authorized_smart_proxy_features.
2019-07-22T08:22:46 [D|app|2fead00e] Examining client certificate to extract dn and sans
2019-07-22T08:22:46 [D|app|2fead00e] Client sent certificate with subject 'li-lc-2224.hag.hilti.com' and subject alt names '["li-lc-2224.hag.hilti.com", "fibssat6c.hag.hilti.com"]'
2019-07-22T08:22:46 [D|app|2fead00e] Verifying request from ["li-lc-2224.hag.hilti.com", "fibssat6c.hag.hilti.com"] against ["li-lc-2224.hag.hilti.com"]
2019-07-22T08:22:47 [D|app|2fead00e] Body: {"message":"ERF42-9911 [Foreman::Exception]: Host is pending for Build"}
2019-07-22T08:22:47 [I|app|2fead00e] Completed 422 Unprocessable Entity in 244ms (Views: 0.6ms | ActiveRecord: 34.7ms)
---------
Requiring debug mode to see the reason for an error is not good. It should always write the error at least at level info when returning '422 Unprocessable Entity'
Version-Release number of selected component (if applicable):
How reproducible:
Steps to Reproduce:
1. Set host to build=true
2. Upload facts
3. What the production.log at level INFO
Actual results:
No root cause why facts upload is failing
Expected results:
Root cause (host is in build mode) is written at least at level INFO
Additional info: