Discovery: Provisioning starts even with errors in provisioning templates

Hi all,

I’m running into in issue with foreman discovery and the first time provisioning of a discovered host, in case there is a problem with the provisioning templates.

Normally when an already known host is (re)build (using the “Build” button in the foreman webinterface) and there is an error while generating the provisioning templates, foreman prevents that provisioning starts and shows the nature of the error to the user. (in my case an exception was raised from the ruby code)

However, when starting with a freshly discovered host and triggering “Provision” for the first time, provisioning starts anyway, even though the generation of the provisioning templates is failing. This result in a host that is unable to be provisioned properly. You only notice that something is wrong when the node stays unreachable after a certain period of time and you to physically look at the console to see that it didn’t even start to provision.

I would expect that the same error would be shown in both cases.

Is that known or expected behavior? Or is that a bug?
Is there a work around to have a quicker reply or indication that there is something wrong with the provisioning templates?

foreman: 1.14.3
discovery: 8.0.1

Also tested with:
foreman: 1.16.0
discovery: 10.0.0