While template rendering I get: Warning! No host could be found for rendering the template

Problem:
I am trying to create Provisioning template. When trying to test, e.g. render template in the context of particular host I get the error/warning
Warning! No host could be found for rendering the template

Seems like I have this problem with any template. Already those imported during installation.

Expected outcome:
Tempalte Preview will work, somehow.

Foreman and Proxy versions:
1.20.3

Foreman and Proxy plugin versions:

2019-08-01T17:28:58 [I|app|] Started POST "/templates/provisioning_templates/41-AutoYaST%20SLES%20default/preview" for 10.xx.xx.xx at 2019-08-01 17:28:58 +0200
2019-08-01T17:28:58 [I|app|f5130] Processing by ProvisioningTemplatesController#preview as */*
2019-08-01T17:28:58 [I|app|f5130]   Parameters: {"template"=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%#\nkind: provision\nname: AutoYaST SLES default\nmodel: ...
...
2019-08-01T17:28:58 [I|app|f5130] Current user set to admin (admin)
2019-08-01T17:28:58 [I|app|f5130]   Rendering text template
2019-08-01T17:28:58 [I|app|f5130]   Rendered text template (0.0ms)
2019-08-01T17:28:58 [I|app|f5130] Completed 404 Not Found in 13ms (Views: 0.5ms | ActiveRecord: 3.7ms)

maybe worth to mention: in the select box there are no host. There is running some kine of search query, but it ends with “Searching… No matches found.”.

Any idea ?? I have more than 100 hosts.

OK, seems like it is just because of the fact that all my hosts were/are unmanaged. And in this case foreman doesnt consider them not to be eligible for template rendering.

All this came because I am currently trying to migrate my old and broken foreman instance to new instance. In order let the new foreman instance know all my hosts, I setup puppet master to send reports my new instance. Now, foreman gets the reports and it creates unmanaged host.

You’re findings are correct. We don’t display unmanaged hosts in the selector there, unamanged hosts typically don’t have data we need to render provisioning template properly configured (e.g. OS, subnet etc). You can convert unmanaged host to managed in edit form. You’ll be asked to provide all mandatory data as part of the process.