blob: caad1b460944887cfb2b1e188fb50b6fb5ccffad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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$
|