Project

General

Profile

Actions

Bug #20549

open

Response of reboot API action needs more readable messages

Added by Rahul Bajaj over 6 years ago. Updated about 3 years ago.

Status:
Ready For Testing
Priority:
Normal
Assignee:
Category:
Discovery plugin
Fixed in Releases:
Found in Releases:

Description

When a reboot fails for one or more hosts, api glues the error messages together and puts them into one message. It also prints details about exception class (Foreman::WrappedException) which makes it even worse to read.

We should remove the wrapped exception details and put each message on it's own line.

Current response:

{"error" => {
  "message" => "Errors during reboot: mac525400d8c85d: ERF50-4973 [Foreman::WrappedException]: Unable to reboot mac525400d8c85d via https://192.168.122.25:8443: Failed to open TCP connection to 192.168.122.25:8443 (No route to host - connect(2) for "192.168.122.25" port 8443) ([Errno::EHOSTUNREACH]: Failed to open TCP connection to 192.168.122.25:8443 (No route to host - connect(2) for...) mac52540022ab12: ERF50-4973 [Foreman::WrappedException]: Unable to reboot mac52540022ab12 via https://192.168.122.156:8443: Failed to open TCP connection to 192.168.122.156:8443 (No route to host - connect(2) for "192.168.122.156" port 8443) ([Errno::EHOSTUNREACH]: Failed to open TCP connection to 192.168.122.156:8443 (No route to host - connect(2) fo...)" 
  }
}

Expected result:

The common messages should put status of each host on a single line. The response should also contain the data about failures in machine readable format.

{ "error" => {
    "message" => "Errors during reboot:\n
Unable to reboot mac525400d8c85d via https://192.168.122.25:8443: Failed to open TCP connection to 192.168.122.25:8443\n
Unable to reboot mac52540022ab12 via https://192.168.122.156:8443: Failed to open TCP connection to 192.168.122.156:8443" 
    "host_details" => [{
      "name" => "mac525400d8c85d",
      "error" => "Failed to open TCP connection to 192.168.122.25:8443" 
    },{
      "name" => "mac52540022ab12",
      "error" => "Failed to open TCP connection to 192.168.122.156:8443" 
    }]
  }
}

It will enable for easier usage in scripts. Eg. hammer can use the 'host_details' for printing nicely formatted messages:

hammer discovery reboot --all
Could not reboot the host(s):
  mac525400d8c85d: Failed to open TCP connection to 192.168.122.25:8443
  mac52540022ab12: Failed to open TCP connection to 192.168.122.156:8443


Related issues 2 (0 open2 closed)

Related to Foreman - Bug #21108: Add host_details to custom error RejectedRahul Bajaj09/26/2017Actions
Related to Discovery - Bug #21109: Format the message passed on by the reboot APIClosedRahul Bajaj09/26/2017Actions
Actions #1

Updated by Tomáš Strachota over 6 years ago

  • Project changed from Hammer CLI to Discovery
  • Subject changed from Remove the wrapped exception details and put each message on it's own line to Response of reboot API action needs more readable messages
  • Description updated (diff)
  • Category changed from Hammer core to Discovery plugin

Thanks for reporting the issue, Rahul. I moved it to project "Discovery" because it's an API issue and it needs to be fixed in the foreman discovery plugin (server side). I also added some more details.

Actions #2

Updated by Rahul Bajaj over 6 years ago

  • Target version set to 220
Actions #3

Updated by The Foreman Bot over 6 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_discovery/pull/380 added
Actions #4

Updated by Rahul Bajaj over 6 years ago

  • Related to Bug #21108: Add host_details to custom error added
Actions #5

Updated by Rahul Bajaj over 6 years ago

  • Related to Bug #21109: Format the message passed on by the reboot API added
Actions #6

Updated by Lukas Zapletal over 5 years ago

  • Target version deleted (536)
  • Triaged set to No
Actions #7

Updated by The Foreman Bot over 5 years ago

  • Pull request https://github.com/theforeman/foreman_discovery/pull/457 added
Actions

Also available in: Atom PDF