blob: 1b725c984069fa0fe674a3ffb3c344510931f3a5 (
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
35
36
37
38
39
40
41
42
|
require 'puppet'
require 'puppet/rails/rails_parameter'
#RailsParameter = Puppet::Rails::RailsParameter
class Puppet::Rails::RailsObject < ActiveRecord::Base
has_many :rails_parameters, :dependent => :delete_all
serialize :tags, Array
belongs_to :host
# Add a set of parameters.
def addparams(params)
params.each do |pname, pvalue|
rails_parameters.build(
:name => pname,
:value => pvalue
)
#self.rails_parameters << pobj
end
end
# Convert our object to a trans_object. Do not retain whether the object
# is collectable, though, since that would cause it to get stripped
# from the configuration.
def to_trans
obj = Puppet::TransObject.new(ptype(), name())
[:file, :line, :tags].each do |method|
if val = send(method)
obj.send(method.to_s + "=", val)
end
end
rails_parameters.each do |param|
obj[param.name] = param.value
end
return obj
end
end
# $Id$
|