Project

General

Profile

Actions

Feature #30696

open

Improve the error output in global registration template

Added by Marek Hulán about 4 years ago. Updated about 3 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Host registration
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

When host is created using the POST /api/hosts in the registration template, we could parse the JSON and present the status in a nicer way. Also if the hostgroup is not assigned to the org/loc we register the host in, we receive ugly error

bash: line 2: error:: command not found.

we should double check this by another API request and fail gracefully.


Related issues 1 (1 open0 closed)

Related to Foreman - Bug #30990: GRT and HRT should use curl with --fail to avoid executing html code on 5xx responsesNewActions
Actions #1

Updated by Marek Hulán about 4 years ago

  • Related to Feature #30440: Simple & automatic host registration WF added
Actions #2

Updated by Marek Hulán about 4 years ago

  • Subject changed from Improve the error output to Improve the error output in global registration template
Actions #3

Updated by Ewoud Kohl van Wijngaarden about 4 years ago

IMHO it should return a non-2xx code. When you use curl --fail it will handle it. That will also handle other errors, like HTTP 502 where the Foreman service didn't respond at all. I think curl --fail is widely available for a long time.

Actions #4

Updated by Leos Stejskal about 4 years ago

I believe this have been fixed in another PR

Actions #5

Updated by Marek Hulán almost 4 years ago

  • Priority changed from Normal to Low

Ok, it's better, currently I'm getting following output

ERROR: not_found
Couldn't find Hostgroup with 'id'=3 [WHERE (1=0)]

which is not terrible but not great. It's probably based on https://github.com/theforeman/foreman/blob/develop/app/controllers/concerns/foreman/controller/registration.rb#L51-L61. I think in this case, we should simply return "ERROR: Host group with id 3 could not be found". So we should specify a custom message, not only based on exception which should be the last resort if there's some uncought exception.

OTOH it's better already and can be considered lower priority.

Actions #6

Updated by Leos Stejskal over 3 years ago

  • Category set to Host registration
Actions #7

Updated by Leos Stejskal over 3 years ago

  • Related to deleted (Feature #30440: Simple & automatic host registration WF)
Actions #8

Updated by Leos Stejskal about 3 years ago

  • Triaged changed from No to Yes
Actions #9

Updated by Leos Stejskal about 3 years ago

  • Related to Bug #30990: GRT and HRT should use curl with --fail to avoid executing html code on 5xx responses added
Actions

Also available in: Atom PDF