Project

General

Profile

Actions

Bug #25290

open

Investigate/update error handling according to latest API

Added by Martin Bacovsky over 5 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Foreman commands (obsolete)
Target version:
-
Difficulty:
Triaged:
Yes
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:
yes

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
Actions #1

Updated by Oleh Fedorenko over 4 years ago

  • Triaged changed from No to Yes
Actions #2

Updated by Shira Maximov over 4 years ago

  • Assignee set to Rahul Bajaj
Actions #3

Updated by Shira Maximov over 4 years ago

  • Status changed from New to Assigned
Actions #4

Updated by Shira Maximov over 4 years ago

  • In Kanboard set to yes
Actions #5

Updated by Oleh Fedorenko over 2 years ago

  • Status changed from Assigned to New
  • Assignee deleted (Rahul Bajaj)
Actions

Also available in: Atom PDF