diff options
| author | shadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-14 23:20:26 +0000 |
|---|---|---|
| committer | shadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-14 23:20:26 +0000 |
| commit | 8714e14c10492361cac62726a3c1abe44d9ec23f (patch) | |
| tree | 007d3d0e5351222a4f49a3d6827b352c1421a538 /lib/puppet/parser | |
| parent | 026ec4f3996655f01b85b03c6db79c9e15d035c5 (diff) | |
New rails stuff redux.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1925 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/collector.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/parser/interpreter.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/parser/resource.rb | 29 | ||||
| -rw-r--r-- | lib/puppet/parser/resource/param.rb | 15 |
4 files changed, 26 insertions, 26 deletions
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb index 71213ee6a..ea54c2dcf 100644 --- a/lib/puppet/parser/collector.rb +++ b/lib/puppet/parser/collector.rb @@ -29,10 +29,10 @@ class Puppet::Parser::Collector # and such, we'll need to vary the conditions, but this works with no # attributes, anyway. time = Puppet::Util.thinmark do - Puppet::Rails::RailsResource.find_all_by_restype_and_exported(@type, true, + Puppet::Rails::Resource.find_all_by_type_and_exported(@type, true, args ).each do |obj| - if existing = @scope.findresource(obj.restype, obj.title) + if existing = @scope.findresource(obj.type, obj.title) # See if we exported it; if so, just move on if @scope.host == obj.host.name next @@ -44,7 +44,7 @@ class Puppet::Parser::Collector else raise Puppet::ParseError, "Exported resource %s[%s] cannot override local resource" % - [obj.restype, obj.title] + [obj.type, obj.title] end end end diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index d2ec1b92c..ec3267b8b 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -4,7 +4,7 @@ require 'puppet' require 'timeout' -require 'puppet/rails' +#require 'puppet/rails' require 'puppet/parser/parser' require 'puppet/parser/scope' diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 751b9c0c7..0802dd882 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -256,7 +256,9 @@ class Puppet::Parser::Resource # with. def store(host) args = {} - %w{type title tags file line exported}.each do |param| + #FIXME: support files/lines, etc. + #%w{type title tags file line exported}.each do |param| + %w{type title exported}.each do |param| if value = self.send(param) args[param] = value end @@ -264,19 +266,18 @@ class Puppet::Parser::Resource # 'type' isn't a valid column name, so we have to use something else. args = symbolize_options(args) - args[:restype] = args[:type] - args.delete(:type) + #args[:type] = args[:type] + #args.delete(:type) # Let's see if the object exists - #if obj = host.rails_resources.find_by_type_and_title(self.type, self.title) - if obj = host.rails_resources.find_by_restype_and_title(self.type, self.title) + if obj = host.resources.find_by_type_and_title(self.type, self.title) # We exist args.each do |param, value| obj[param] = value end else # Else create it anew - obj = host.rails_resources.build(args) + obj = host.resources.build(args) end # Either way, now add our parameters @@ -287,13 +288,13 @@ class Puppet::Parser::Resource return obj end - def tags - unless defined? @tags - @tags = scope.tags - @tags << self.type - end - @tags - end + #def tags + # unless defined? @tags + # @tags = scope.tags + # @tags << self.type + # end + # @tags + #end def to_hash @params.inject({}) do |hash, ary| @@ -334,7 +335,7 @@ class Puppet::Parser::Resource obj.file = self.file obj.line = self.line - obj.tags = self.tags + #obj.tags = self.tags return obj end diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb index 023e4e75d..2e5d78034 100644 --- a/lib/puppet/parser/resource/param.rb +++ b/lib/puppet/parser/resource/param.rb @@ -18,19 +18,18 @@ class Puppet::Parser::Resource::Param # Store this parameter in a Rails db. def store(resource) args = {} - [:name, :value, :line, :file].each do |var| + #[:name, :value, :line, :file].each do |var| + [:name, :value].each do |var| args[var] = self.send(var) end args[:name] = args[:name].to_s - if obj = resource.rails_parameters.find_by_name(self.name) - # We exist - args.each do |p, v| - obj[p] = v + args[:name].each do |name| + pn = resource.param_names.find_or_create_by_name(name) + args[:value].each do |value| + pv = pn.param_values.find_or_create_by_value(value) end - else - # Else create it anew - obj = resource.rails_parameters.build(args) end + obj = resource.param_names.find_by_name(args[:name], :include => :param_values) return obj end |
