class FileDataSource
Public Instance Methods
common()
click to toggle source
# File lib/tiller/data/file.rb, line 42 def common @config_hash.key?('common') ? @config_hash['common'] : {} end
global_values()
click to toggle source
# File lib/tiller/data/file.rb, line 38 def global_values @config_hash.key?('global_values') ? @config_hash['global_values'] : {} end
setup()
click to toggle source
Open and parse the environment file. Tries from v2 format common.yaml first, if that failes, then it looks for separate environment files.
# File lib/tiller/data/file.rb, line 9 def setup if Tiller::config.has_key?('environments') # Try and load from v2 format common.yaml if Tiller::config['environments'].has_key?(Tiller::config[:environment]) Tiller::log.debug("#{self} : Using values from v2 format common.yaml") if Tiller::config['environments'][Tiller::config[:environment]].is_a? Hash @config_hash = Tiller::config['environments'][Tiller::config[:environment]] else # This permits "stub"" environments, where all the config is provided by another module e.g. defaults # See https://github.com/markround/tiller/issues/29 Tiller::log.info("Using stub environment for #{Tiller::config[:environment]}") @config_hash = Hash.new end else abort("Error : Could not load environment #{Tiller::config[:environment]} from common.yaml") end else # Try and load from v1 format files begin env_file = File.join(Tiller::config[:tiller_base], 'environments', "#{Tiller::config[:environment]}.yaml") @config_hash = YAML.load(open(env_file)) @config_hash ||= Hash.new #in case YAML.load returned false rescue abort("Error : Could not load environment file #{env_file}") end end end
target_values(template_name)
click to toggle source
# File lib/tiller/data/file.rb, line 60 def target_values(template_name) if (Tiller::config['plugin_api_version'] == 2) Tiller::log.fatal("Deprecated : We should never get here") exit else return @config_hash.key?(template_name) ? @config_hash[template_name] : {} end end
values(template_name)
click to toggle source
# File lib/tiller/data/file.rb, line 46 def values(template_name) if (Tiller::config['plugin_api_version'] == 2) # Everything comes from the values method in V2 if @config_hash.key?(template_name) all_values=[] @config_hash[template_name].each { |values| all_values << values } return all_values end else return @config_hash.key?(template_name) ? @config_hash[template_name]['config'] : {} end end