Actions
Bug #25290
openInvestigate/update error handling according to latest API
Status:
New
Priority:
Normal
Assignee:
-
Category:
Foreman commands (obsolete)
Target version:
-
Description
Some API error responses do not have usual format and are not handled well by Hammer. This needs to be investigated if it is new API pattern and Hammer needs to be updated or if it is unintended API inconsistency and API should be fixed.
Unexpected format was spotted in:
[ INFO 2018-10-23T23:31:07 API] PUT /api/hosts/4/boot [DEBUG 2018-10-23T23:31:07 API] Params: { "device" => "dis" } [DEBUG 2018-10-23T23:31:07 API] Headers: {} [DEBUG 2018-10-23T23:31:07 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth [ERROR 2018-10-23T23:31:08 API] 422 Unprocessable Entity [DEBUG 2018-10-23T23:31:08 API] { "error" => "Unknown device: available devices are disk, cdrom, pxe, bios" } [DEBUG 2018-10-23T23:31:08 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_unprocessable_entity [ERROR 2018-10-23T23:31:08 Exception] <NilClass> nil >Failed to boot the host from device<
The response is expected to have {"message" => "error message"}
[ INFO 2018-10-23T23:33:31 API] PUT /api/hosts/4/boot [DEBUG 2018-10-23T23:33:31 API] Params: { "device" => "disk" } [DEBUG 2018-10-23T23:33:31 API] Headers: {} [DEBUG 2018-10-23T23:33:31 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth [ERROR 2018-10-23T23:33:31 API] 422 Unprocessable Entity [DEBUG 2018-10-23T23:33:31 API] { "message" => "ERF42-5779 [Foreman::Exception]: No BMC NIC available for host centos7.example.com" } [DEBUG 2018-10-23T23:33:31 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_unprocessable_entity [ERROR 2018-10-23T23:33:31 Exception] ERF42-5779 [Foreman::Exception]: No BMC NIC available for host centos7.example.com >Failed to boot the host from device<: ERF42-5779 [Foreman::Exception]: No BMC NIC available for host centos7.example.com
Some error messages have prepended "ERF42-5779 [Foreman::Exception]: " or similar. The same appeared in some 500:
[ INFO 2018-10-23T23:34:55 API] PUT /api/hosts/4/power [DEBUG 2018-10-23T23:34:55 API] Params: { "power_action" => :cycle } [DEBUG 2018-10-23T23:34:55 API] Headers: {} [DEBUG 2018-10-23T23:34:55 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth [ERROR 2018-10-23T23:34:55 API] 500 Internal Server Error [DEBUG 2018-10-23T23:34:55 API] { "error" => { "message" => "ERF42-1251 [Foreman::Exception]: Error has occurred while communicating with Libvirt (Libvirt): Error making a connection to libvirt URI qemu+ssh://root@192.168.121.1/system:\nCall to virConnectOpen failed: Cannot recv data: ssh: connect to host 192.168.121.1 port 22: Connection refused: Connection reset by peer" } } [DEBUG 2018-10-23T23:34:55 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_internal_error [ERROR 2018-10-23T23:34:55 Exception] ERF42-1251 [Foreman::Exception]: Error has occurred while communicating with Libvirt (Libvirt): Error making a connection to libvirt URI qemu+ssh://root@192.168.121.1/system: Call to virConnectOpen failed: Cannot recv data: ssh: connect to host 192.168.121.1 port 22: Connection refused: Connection reset by peer >Failed to reset the host<: ERF42-1251 [Foreman::Exception]: Error has occurred while communicating with Libvirt (Libvirt): Error making a connection to libvirt URI qemu+ssh://root@192.168.121.1/system: Call to virConnectOpen failed: Cannot recv data: ssh: connect to host 192.168.121.1 port 22: Connection refused: Connection reset by peer
and also
[ INFO 2018-10-23T23:43:30 API] GET /api/compute_resources/1/available_clusters [DEBUG 2018-10-23T23:43:30 API] Params: {} [DEBUG 2018-10-23T23:43:30 API] Headers: { :params => {} } [DEBUG 2018-10-23T23:43:30 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth [ERROR 2018-10-23T23:43:30 API] 500 Internal Server Error [DEBUG 2018-10-23T23:43:30 API] { "error" => { "message" => "ERF42-7329 [Foreman::Exception]: Not implemented for Libvirt" } } [DEBUG 2018-10-23T23:43:30 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_internal_error [ERROR 2018-10-23T23:43:30 Exception] ERF42-7329 [Foreman::Exception]: Not implemented for Libvirt ERF42-7329 [Foreman::Exception]: Not implemented for Libvirt
Updated by Oleh Fedorenko over 2 years ago
- Status changed from Assigned to New
- Assignee deleted (
Rahul Bajaj)
Actions