Feature #30696
openImprove the error output in global registration template
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.
Updated by Marek Hulán about 4 years ago
- Related to Feature #30440: Simple & automatic host registration WF added
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
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.
Updated by Leos Stejskal about 4 years ago
I believe this have been fixed in another PR
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.
Updated by Leos Stejskal over 3 years ago
- Related to deleted (Feature #30440: Simple & automatic host registration WF)
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