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/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/rails_resource.rb')
-rw-r--r-- | lib/puppet/rails/rails_resource.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/puppet/rails/rails_resource.rb b/lib/puppet/rails/rails_resource.rb new file mode 100644 index 000000000..caad1b460 --- /dev/null +++ b/lib/puppet/rails/rails_resource.rb @@ -0,0 +1,34 @@ +require 'puppet' +require 'puppet/rails/rails_parameter' + +#RailsParameter = Puppet::Rails::RailsParameter +class Puppet::Rails::RailsResource < ActiveRecord::Base + has_many :rails_parameters, :dependent => :delete_all + serialize :tags, Array + + belongs_to :host + + # 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["type"] = hash["restype"] + hash.delete("restype") + hash.delete("host_id") + hash.delete("id") + hash.each do |p, v| + hash.delete(p) if v.nil? + end + hash[:scope] = scope + hash[:source] = scope.source + obj = Puppet::Parser::Resource.new(hash) + rails_parameters.each do |param| + obj.set(param.to_resourceparam(scope.source)) + end + + return obj + end +end + +# $Id$ |