From 24d48e6c07ef634971fcb8ed5b27258db161a018 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 14 Feb 2009 19:28:10 +0100 Subject: Fix #1972 - ActiveRecord fixes resulted in broken tests Fix #1930 was not complete, with some typos and misuse of unused code paths in the regular puppetmaster use case. Signed-off-by: Brice Figureau --- lib/puppet/rails/resource.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/puppet/rails') diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb index bd2739d53..c3d287af2 100644 --- a/lib/puppet/rails/resource.rb +++ b/lib/puppet/rails/resource.rb @@ -1,5 +1,6 @@ require 'puppet' require 'puppet/rails/param_name' +require 'puppet/rails/param_value' require 'puppet/rails/puppet_tag' require 'puppet/util/rails/collection_merger' @@ -57,7 +58,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base # returns a hash of param_names.name => [param_values] def get_params_hash(values = nil) - values ||= @params_hash || Puppet::Rails::ParamValues.find_all_params_from_resource(id) + values ||= @params_hash || Puppet::Rails::ParamValue.find_all_params_from_resource(self) if values.size == 0 return {} end @@ -69,7 +70,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base end def get_tag_hash(tags = nil) - tags ||= @tags_hash || Puppet::Rails::ResourceTag.find_all_tags_from_resource(id) + tags ||= @tags_hash || Puppet::Rails::ResourceTag.find_all_tags_from_resource(self) return tags.inject({}) do |hash, tag| # We have to store the tag object, not just the tag name. hash[tag['name']] = tag @@ -99,7 +100,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base result = get_params_hash result.each do |param, value| if value.is_a?(Array) - result[param] = value.collect { |v| v.value } + result[param] = value.collect { |v| v['value'] } else result[param] = value.value end -- cgit