From ff67e09ab7730d4f2ba30b861e4460225cc51a96 Mon Sep 17 00:00:00 2001 From: Alexander Olofsson <alexander.olofsson@liu.se> Date: Mon, 10 Aug 2020 16:12:02 +0200 Subject: [PATCH] Update rendering code to be 2.0 --- .../unattended_controller_extensions.rb | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/controllers/concerns/foreman_wds/unattended_controller_extensions.rb b/app/controllers/concerns/foreman_wds/unattended_controller_extensions.rb index c90138e..9fb2057 100644 --- a/app/controllers/concerns/foreman_wds/unattended_controller_extensions.rb +++ b/app/controllers/concerns/foreman_wds/unattended_controller_extensions.rb @@ -6,25 +6,21 @@ module ForemanWds super end - def load_template_vars - super unless params[:kind] == 'wds_localboot' - end - private def wds_render_csr - return render(:plain => 'Host not in build mode') unless @host and @host.build? + return unless verify_found_host + return head(:method_not_allowed) unless allowed_to_install? template = ProvisioningTemplate.find_by_name('csr_attributes.yaml') + return safe_render(template) if template - content = @host.render_template template: template - raise Foreman::Exception.new(N_("Template '%s' didn't render correctly"), template.name) unless content - - render plain: content + return head(:not_found) end def wds_deploy_localboot - return render(:plain => 'Host not in build mode') unless @host and @host.build? + return unless verify_found_host + return head(:method_not_allowed) unless allowed_to_install? iface = @host.provision_interface -- GitLab