Open
Description
Currently when template for hostgroup is rendered it queries the database directly - https://github.com/theforeman/foreman/blob/f715a7c98457c6f43a1f803a75ba4540372d8544/app/controllers/unattended_controller.rb#L43-L45 so we don't have the option to render the template from file without corresponding template in the database. One of the options to fix it would be to change:
template = ProvisioningTemplate.find_by_name(params['id'].to_s)
@host = Hostgroup.find_by_title(params['hostgroup'].to_s)
to:
@host = Hostgroup.find_by_title(params['hostgroup'].to_s)
template = @host.provisioning_template(params['id'].to_s)
Activity