Sha256: 978df8cb53d52e956d58884d313263907ea4ad989fbfa930dbfb7e0c726e21ad

Contents?: true

Size: 913 Bytes

Versions: 8

Compression:

Stored size: 913 Bytes

Contents

require 'uri'

module ForemanBootdisk
  class Renderer
    include ::Foreman::Renderer
    include Rails.application.routes.url_helpers

    def generic_template_render
      if (Gem::Version.new(SETTINGS[:version].notag) < Gem::Version.new('1.5')) && Setting[:safemode_render]
        raise(::Foreman::Exception.new(N_('Bootdisk is not supported with safemode rendering, please disable safemode_render under Adminster>Settings')))
      end

      tmpl = ConfigTemplate.find_by_name(Setting[:bootdisk_generic_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_generic_host_template'))
      @host = Struct.new(:token).new(nil)
      unattended_render(tmpl.template)
    end

    def bootdisk_chain_url(action = 'iPXE')
      u = URI.parse(foreman_url(action))
      u.query = "#{u.query}&mac="
      u.fragment = nil
      u.to_s
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_bootdisk-4.0.1 app/services/foreman_bootdisk/renderer.rb
foreman_bootdisk-3.2.1 app/services/foreman_bootdisk/renderer.rb
foreman_bootdisk-4.0.0 app/services/foreman_bootdisk/renderer.rb
foreman_bootdisk-3.2.0 app/services/foreman_bootdisk/renderer.rb
foreman_bootdisk-3.1.2 app/services/foreman_bootdisk/renderer.rb
foreman_bootdisk-3.1.1 app/services/foreman_bootdisk/renderer.rb
foreman_bootdisk-3.1.0 app/services/foreman_bootdisk/renderer.rb
foreman_bootdisk-3.0.0 app/services/foreman_bootdisk/renderer.rb