class Slh::Models::Host

This model represents the actual hostname/machine the shib SP instance lives on

Attributes

host_type[RW]
name[R]

CORE API METHODS END #

parent_strategy[R]

CORE API METHODS END #

shib_prefix[RW]
sites[R]

CORE API METHODS END #

Public Class Methods

new(host_name,parent_strategy,&block) click to toggle source
# File lib/slh/models/host.rb, line 15
def initialize(host_name,parent_strategy,&block)
  @parent_strategy = parent_strategy
  @name = host_name
  @host_type = :apache
  @sites = []
  if block_given?
    self.instance_eval(&block)
  end

  if self.sites.length == 0
    raise "Misconfiguration on host=#{self.name}: You must define at least one site for a host even if it's the same name as the host"
  end
  if self.host_type == :iis
    if self.sites.detect {|x| x.site_id.nil?}
      raise "If your :host_type is iis, you must specify :site_id for all of your sites"
    end
  end
end

Public Instance Methods

config_dir() click to toggle source
# File lib/slh/models/host.rb, line 47
def config_dir
  File.join(self.parent_strategy.config_dir,self.name.to_s)
end
for_site(site_name, &block) click to toggle source

CORE API METHODS BEGIN #

# File lib/slh/models/host.rb, line 6
def for_site(site_name, &block)
  @sites << Slh::Models::Site.new(site_name,self, &block)
end
prefixed_filepath_for(filename) click to toggle source

File.join(”, ‘asdf.txt’) returns ‘/asdf.txt’. We need a way to accomodate shib_prefix when needed, but avoiding values like ‘/shibboleth2.xml’ when a prefix isn’t set. For interpolation into templates

# File lib/slh/models/host.rb, line 39
def prefixed_filepath_for(filename)
  filepath = filename
  unless @shib_prefix.nil?
    filepath = File.join(@shib_prefix, filename)
  end
  filepath
end
shibboleth2_path() click to toggle source

refers to the file within this checkout

# File lib/slh/models/host.rb, line 52
def shibboleth2_path
  File.join(self.config_dir,'shibboleth2.xml')
end