diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-13 07:49:48 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-13 07:49:48 +0000 |
commit | 35de0e3bd74e94de92ac0e9209a4884cf07c88a0 (patch) | |
tree | be7119181bc15dad6575cc5b7087c92cfd7fbac8 /lib/puppet/rails/resource.rb | |
parent | 26b32b953d8e097785b38aa90e5e4bff6ae9247e (diff) | |
download | puppet-35de0e3bd74e94de92ac0e9209a4884cf07c88a0.tar.gz puppet-35de0e3bd74e94de92ac0e9209a4884cf07c88a0.tar.xz puppet-35de0e3bd74e94de92ac0e9209a4884cf07c88a0.zip |
Temporarily reverting all of the recent rails work so that I can release 0.20.1
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1873 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails/resource.rb')
-rw-r--r-- | lib/puppet/rails/resource.rb | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb deleted file mode 100644 index bbe71305c..000000000 --- a/lib/puppet/rails/resource.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'puppet' -require 'puppet/rails/lib/init' -require 'puppet/rails/param_name' - -class Puppet::Rails::Resource < ActiveRecord::Base - has_many :param_values, :through => :param_names - has_many :param_names - has_many :source_files - belongs_to :hosts - - acts_as_taggable - - Puppet::Type.eachtype do |type| - klass = Class.new(Puppet::Rails::Resource) - Object.const_set("Puppet%s" % type.name.to_s.capitalize, klass) - end - - def parameters - hash = {} - self.param_values.find(:all).each do |pvalue| - pname = self.param_names.find(:first) - hash.store(pname.name.to_sym, pvalue.value) - end - return hash - end - - # Convert our object to a resource. Do not retain whether the object - # is collectable, though, since that would cause it to get stripped - # from the configuration. - def to_resource(scope) - hash = self.attributes - hash.delete("type") - hash.delete("host_id") - hash.delete("source_file_id") - hash.delete("id") - hash.each do |p, v| - hash.delete(p) if v.nil? - end - hash[:type] = self.class.to_s.gsub(/Puppet/,'').downcase - hash[:scope] = scope - hash[:source] = scope.source - obj = Puppet::Parser::Resource.new(hash) - self.param_names.each do |pname| - obj.set(pname.to_resourceparam(scope.source)) - end - - return obj - end -end |