class ConsulTemplateSource

Public Instance Methods

template(template_name) click to toggle source
# File lib/tiller/template/consul.rb, line 24
def template(template_name)
  path = interpolate("#{@consul_config['templates']}")
  Diplomat::Kv.get("#{path}/#{template_name}", {:dc => @consul_config['dc']})
end
templates() click to toggle source
# File lib/tiller/template/consul.rb, line 10
def templates
  return [] unless Tiller::config.has_key?('consul')
  path = interpolate("#{@consul_config['templates']}")
  Tiller::log.debug("#{self} : Fetching templates from #{path}")
  templates = Diplomat::Kv.get(path, {:keys => true, :dc => @consul_config['dc']}, :return)

  if templates.is_a? Array
    templates.map { |t| File.basename(t) }
  else
    Tiller::log.warn("Consul : No templates could be fetched from #{path}")
    []
  end
end