lib/kafo/configuration.rb in kafo-0.9.4 vs lib/kafo/configuration.rb in kafo-0.9.5
- old
+ new
@@ -86,10 +86,14 @@
def modules
@modules ||= @data.keys.map { |mod| PuppetModule.new(mod, PuppetModule.find_parser, self).parse }.sort
end
+ def module(name)
+ modules.find { |m| m.name == name }
+ end
+
def root_dir
File.expand_path(app[:installer_dir])
end
def check_dirs
@@ -182,12 +186,13 @@
def params
@params ||= modules.map(&:params).flatten
end
- def param(mod, name)
- params.detect { |p| p.name == name && p.module.name == mod }
+ def param(mod_name, param_name)
+ mod = self.module(mod_name)
+ mod.nil? ? nil : mod.params.find { |p| p.name == param_name }
end
def preset_defaults_from_puppet
# set values based on default_values
params.each do |param|
@@ -262,10 +267,10 @@
@config_file.gsub(/\.yaml$/, '.migrations')
end
def parser_cache
if app[:parser_cache_path]
- @parser_cache ||= Kafo::ParserCacheReader.new_from_file(File.expand_path(app[:parser_cache_path]))
+ @parser_cache ||= Kafo::ParserCacheReader.new_from_file(app[:parser_cache_path])
end
end
private