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.
Category:
Host registration
|
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 open — 0 closed)
- Related to Feature #30440: Simple & automatic host registration WF added
- Subject changed from Improve the error output to Improve the error output in global registration template
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.
I believe this have been fixed in another PR
- 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.
- Category set to Host registration
- Related to deleted (Feature #30440: Simple & automatic host registration WF)
- Triaged changed from No to Yes
- Related to Bug #30990: GRT and HRT should use curl with --fail to avoid executing html code on 5xx responses added
Also available in: Atom
PDF