Sha256: e8473cf90b92848ee3adf80c439e37ae438d66f408f21318ec7374651d8bb1d6

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

# These helpers are provided as convenience methods available to the writers of templates
# and are mixed in to Host
module HostTemplateHelpers
  # Calculates the media's path in relation to the domain and convert host to an IP
  def install_path
    operatingsystem.interpolate_medium_vars(operatingsystem.media_path(medium, domain), architecture.name, operatingsystem)
  end

  # Calculates the jumpstart path in relation to the domain and convert host to an IP
  def jumpstart_path
    operatingsystem.jumpstart_path medium, domain
  end

  def multiboot
    operatingsystem.pxe_prefix(architecture) + "-multiboot"
  end

  def miniroot
    operatingsystem.initrd(architecture)
  end

  def media_path
    operatingsystem.medium_uri(self)
  end

  #returns the URL for Foreman based on the required action
  def foreman_url(action = "provision")
    url_for :only_path => false, :controller => "/unattended",
            :action => action,
            :token => (@host.token.value unless @host.token.nil?)
  end

  attr_writer(:url_options)

  # used by url_for to generate the path correctly
  def url_options
    url_options = (@url_options || {}).deep_dup()
    url_options[:protocol] = "http://"
    url_options[:host] = Setting[:foreman_url] if Setting[:foreman_url]
    url_options
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/models/host_template_helpers.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/models/host_template_helpers.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/models/host_template_helpers.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/models/host_template_helpers.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/models/host_template_helpers.rb