puppet 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +51 -195
- data/LICENSE +2 -2
- data/conf/suse/puppet.spec +13 -10
- data/install.rb +7 -13
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application.rb +17 -21
- data/lib/puppet/defaults.rb +1 -1
- data/lib/puppet/dsl.rb +0 -4
- data/lib/puppet/dsl/resource_type_api.rb +16 -10
- data/lib/puppet/external/event-loop/event-loop.rb +15 -11
- data/lib/puppet/feature/base.rb +2 -1
- data/lib/puppet/feature/rails.rb +1 -3
- data/lib/puppet/network/http/webrick/rest.rb +1 -0
- data/lib/puppet/network/http_pool.rb +0 -12
- data/lib/puppet/parser/ast/function.rb +1 -1
- data/lib/puppet/parser/ast/resource.rb +1 -5
- data/lib/puppet/parser/functions/extlookup.rb +1 -1
- data/lib/puppet/parser/functions/versioncmp.rb +3 -3
- data/lib/puppet/parser/lexer.rb +1 -1
- data/lib/puppet/parser/parser_support.rb +4 -2
- data/lib/puppet/parser/resource.rb +8 -0
- data/lib/puppet/parser/type_loader.rb +50 -48
- data/lib/puppet/provider/nameservice.rb +1 -0
- data/lib/puppet/provider/nameservice/objectadd.rb +2 -1
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +16 -9
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -0
- data/lib/puppet/provider/user/hpux.rb +0 -1
- data/lib/puppet/provider/user/user_role_add.rb +21 -9
- data/lib/puppet/provider/user/useradd.rb +44 -3
- data/lib/puppet/rails.rb +3 -3
- data/lib/puppet/reference/configuration.rb +7 -12
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +10 -9
- data/lib/puppet/reference/type.rb +6 -6
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/ssl/certificate_request.rb +1 -1
- data/lib/puppet/sslcertificates/ca.rb +4 -10
- data/lib/puppet/type.rb +3 -3
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/tidy.rb +1 -0
- data/lib/puppet/type/user.rb +55 -0
- data/lib/puppet/type/whit.rb +4 -0
- data/lib/puppet/util.rb +8 -0
- data/lib/puppet/util/metric.rb +38 -9
- data/lib/puppet/util/rdoc/parser.rb +10 -7
- data/lib/puppet/util/reference.rb +4 -4
- data/lib/puppet/util/zaml.rb +0 -1
- data/spec/fixtures/yaml/report0.25.x.yaml +64 -0
- data/spec/fixtures/yaml/report2.6.x.yaml +190 -0
- data/spec/integration/application/doc_spec.rb +55 -0
- data/spec/integration/defaults_spec.rb +1 -1
- data/spec/integration/parser/compiler_spec.rb +21 -0
- data/spec/integration/parser/ruby_manifest_spec.rb +128 -0
- data/spec/lib/puppet_spec/files.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/application_spec.rb +16 -25
- data/spec/unit/dsl/resource_type_api_spec.rb +32 -12
- data/spec/unit/indirector/node/active_record_spec.rb +0 -1
- data/spec/unit/parser/ast/function_spec.rb +14 -4
- data/spec/unit/parser/lexer_spec.rb +8 -0
- data/spec/unit/parser/parser_spec.rb +0 -9
- data/spec/unit/parser/type_loader_spec.rb +3 -16
- data/spec/unit/provider/service/launchd_spec.rb +8 -5
- data/spec/unit/provider/user/user_role_add_spec.rb +18 -1
- data/spec/unit/provider/user/useradd_spec.rb +19 -0
- data/spec/unit/rails_spec.rb +10 -4
- data/spec/unit/reports/rrdgraph_spec.rb +31 -0
- data/spec/unit/reports/tagmail_spec.rb +1 -0
- data/spec/unit/sslcertificates/ca_spec.rb +110 -0
- data/spec/unit/type/user_spec.rb +19 -1
- data/spec/unit/type/whit_spec.rb +11 -0
- data/spec/unit/type_spec.rb +7 -0
- data/spec/unit/util/rdoc/parser_spec.rb +18 -14
- data/spec/unit/util/zaml_spec.rb +2 -1
- metadata +11 -6
- data/conf/suse/ruby-env.patch +0 -17
- data/test/certmgr/ca.rb +0 -87
data/lib/puppet/rails.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'facter'
|
4
4
|
require 'puppet'
|
5
|
+
require 'logger'
|
5
6
|
|
6
7
|
module Puppet::Rails
|
7
8
|
TIME_DEBUG = true
|
@@ -22,9 +23,8 @@ module Puppet::Rails
|
|
22
23
|
ActiveRecord::Base.logger.level = Logger::DEBUG
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
end
|
26
|
+
# As of ActiveRecord 2.2 allow_concurrency has been deprecated and no longer has any effect.
|
27
|
+
ActiveRecord::Base.allow_concurrency = true if Puppet::Util.activerecord_version < 2.2
|
28
28
|
|
29
29
|
ActiveRecord::Base.verify_active_connections!
|
30
30
|
|
@@ -42,11 +42,10 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
|
|
42
42
|
end
|
43
43
|
|
44
44
|
config.header = "
|
45
|
-
Specifying Configuration Parameters
|
46
|
-
|
45
|
+
## Specifying Configuration Parameters
|
46
|
+
|
47
|
+
### On The Command-Line
|
47
48
|
|
48
|
-
On The Command-Line
|
49
|
-
+++++++++++++++++++
|
50
49
|
Every Puppet executable (with the exception of `puppetdoc`) accepts all of
|
51
50
|
the parameters below, but not all of the arguments make sense for every executable.
|
52
51
|
|
@@ -69,8 +68,7 @@ syntax on the command line:
|
|
69
68
|
The invocations above will enable and disable, respectively, the storage of
|
70
69
|
the client configuration.
|
71
70
|
|
72
|
-
Configuration Files
|
73
|
-
+++++++++++++++++++
|
71
|
+
### Configuration Files
|
74
72
|
|
75
73
|
As mentioned above, the configuration parameters can also be stored in a
|
76
74
|
configuration file, located in the configuration directory. As root, the
|
@@ -84,8 +82,7 @@ executables look for `puppet.conf` in their configuration directory
|
|
84
82
|
All executables will set any parameters set within the `[main]` section,
|
85
83
|
and each executable will also use one of the `[master]`, `[agent]`.
|
86
84
|
|
87
|
-
File Format
|
88
|
-
'''''''''''
|
85
|
+
#### File Format
|
89
86
|
|
90
87
|
The file follows INI-style formatting. Here is an example of a very simple
|
91
88
|
`puppet.conf` file:
|
@@ -127,8 +124,7 @@ and one `puppet` user) if it is invoked as `root` with the `--mkusers` argument:
|
|
127
124
|
|
128
125
|
$ puppet agent --mkusers
|
129
126
|
|
130
|
-
Signals
|
131
|
-
-------
|
127
|
+
## Signals
|
132
128
|
|
133
129
|
The `puppet agent` and `puppet master` executables catch some signals for special
|
134
130
|
handling. Both daemons catch (`SIGHUP`), which forces the server to restart
|
@@ -139,8 +135,7 @@ Sending the `SIGUSR1` signal to an instance of `puppet agent` will cause it to
|
|
139
135
|
immediately begin a new configuration transaction with the server. This
|
140
136
|
signal has no effect on `puppet master`.
|
141
137
|
|
142
|
-
Configuration Parameter Reference
|
143
|
-
---------------------------------
|
138
|
+
## Configuration Parameter Reference
|
144
139
|
|
145
140
|
Below is a list of all documented parameters. Not all of them are valid with all
|
146
141
|
Puppet executables, but the executables will ignore any inappropriate values.
|
@@ -8,12 +8,12 @@ reference = Puppet::Util::Reference.newreference :indirection, :doc => "Indirect
|
|
8
8
|
Puppet::Indirector::Indirection.instances.sort { |a,b| a.to_s <=> b.to_s }.each do |indirection|
|
9
9
|
ind = Puppet::Indirector::Indirection.instance(indirection)
|
10
10
|
name = indirection.to_s.capitalize
|
11
|
-
text +=
|
11
|
+
text += "## " + indirection.to_s + "\n\n"
|
12
12
|
|
13
13
|
text += ind.doc + "\n\n"
|
14
14
|
|
15
15
|
Puppet::Indirector::Terminus.terminus_classes(ind.name).sort { |a,b| a.to_s <=> b.to_s }.each do |terminus|
|
16
|
-
text +=
|
16
|
+
text += "### " + terminus.to_s + "\n\n"
|
17
17
|
|
18
18
|
term_class = Puppet::Indirector::Terminus.terminus_class(ind.name, terminus)
|
19
19
|
|
@@ -9,16 +9,17 @@ metaparameter = Puppet::Util::Reference.newreference :metaparameter, :doc => "Al
|
|
9
9
|
}
|
10
10
|
|
11
11
|
str = %{
|
12
|
-
Metaparameters
|
13
|
-
--------------
|
14
|
-
Metaparameters are parameters that work with any resource type; they are part of the
|
15
|
-
Puppet framework itself rather than being part of the implementation of any
|
16
|
-
given instance. Thus, any defined metaparameter can be used with any instance
|
17
|
-
in your manifest, including defined components.
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
# Metaparameters
|
14
|
+
|
15
|
+
Metaparameters are parameters that work with any resource type; they are part of the
|
16
|
+
Puppet framework itself rather than being part of the implementation of any
|
17
|
+
given instance. Thus, any defined metaparameter can be used with any instance
|
18
|
+
in your manifest, including defined components.
|
19
|
+
|
20
|
+
## Available Metaparameters
|
21
|
+
|
22
|
+
}
|
22
23
|
begin
|
23
24
|
params = []
|
24
25
|
Puppet::Type.eachmetaparam { |param|
|
@@ -5,15 +5,15 @@ type = Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource
|
|
5
5
|
Puppet::Type.eachtype { |type|
|
6
6
|
next if type.name == :puppet
|
7
7
|
next if type.name == :component
|
8
|
+
next if type.name == :whit
|
8
9
|
types[type.name] = type
|
9
10
|
}
|
10
11
|
|
11
12
|
str = %{
|
12
13
|
|
13
|
-
|
14
|
-
--------------
|
14
|
+
## Resource Types
|
15
15
|
|
16
|
-
|
16
|
+
- The *namevar* is the parameter used to uniquely identify a type instance.
|
17
17
|
This is the parameter that gets assigned when a string is provided before
|
18
18
|
the colon in a type declaration. In general, only developers will need to
|
19
19
|
worry about which parameter is the `namevar`.
|
@@ -30,11 +30,11 @@ type = Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource
|
|
30
30
|
dependency handling), and because `path` is the namevar for `file`, that
|
31
31
|
string is assigned to the `path` parameter.
|
32
32
|
|
33
|
-
|
33
|
+
- *Parameters* determine the specific configuration of the instance. They either
|
34
34
|
directly modify the system (internally, these are called properties) or they affect
|
35
35
|
how the instance behaves (e.g., adding a search path for `exec` instances or determining recursion on `file` instances).
|
36
36
|
|
37
|
-
|
37
|
+
- *Providers* provide low-level functionality for a given resource type. This is
|
38
38
|
usually in the form of calling out to external commands.
|
39
39
|
|
40
40
|
When required binaries are specified for providers, fully qualifed paths
|
@@ -42,7 +42,7 @@ type = Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource
|
|
42
42
|
binaries indicate that Puppet will search for the binary using the shell
|
43
43
|
path.
|
44
44
|
|
45
|
-
|
45
|
+
- *Features* are abilities that some providers might not support. You can use the list
|
46
46
|
of supported features to determine how a given provider can be used.
|
47
47
|
|
48
48
|
Resource types define features they can use, and providers can be tested to see
|
@@ -122,7 +122,7 @@ Puppet::Reports.register_report(:rrdgraph) do
|
|
122
122
|
# that means we record the total time, the config time, and that's about
|
123
123
|
# it. We should probably send each type's time as a separate metric.
|
124
124
|
def timeclean(metric)
|
125
|
-
metric.values = metric.values.find_all { |name, label, value| [
|
125
|
+
metric.values = metric.values.find_all { |name, label, value| ['total', 'config_retrieval'].include?(name.to_s) }
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -29,7 +29,7 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base
|
|
29
29
|
# Support either an actual SSL key, or a Puppet key.
|
30
30
|
key = key.content if key.is_a?(Puppet::SSL::Key)
|
31
31
|
|
32
|
-
# If we're a CSR for the CA, then use the real
|
32
|
+
# If we're a CSR for the CA, then use the real ca_name, rather than the
|
33
33
|
# fake 'ca' name. This is mostly for backward compatibility with 0.24.x,
|
34
34
|
# but it's also just a good idea.
|
35
35
|
common_name = name == Puppet::SSL::CA_NAME ? Puppet.settings[:ca_name] : name
|
@@ -147,21 +147,19 @@ class Puppet::SSLCertificates::CA
|
|
147
147
|
|
148
148
|
# Create the root certificate.
|
149
149
|
def mkrootcert
|
150
|
-
# Make the root cert's name the FQDN of the host running the CA.
|
151
|
-
name = Facter["hostname"].value
|
150
|
+
# Make the root cert's name "Puppet CA: " plus the FQDN of the host running the CA.
|
151
|
+
name = "Puppet CA: #{Facter["hostname"].value}"
|
152
152
|
if domain = Facter["domain"].value
|
153
153
|
name += ".#{domain}"
|
154
154
|
end
|
155
155
|
|
156
|
-
|
157
|
-
|
156
|
+
cert = Certificate.new(
|
158
157
|
:name => name,
|
159
158
|
:cert => @config[:cacert],
|
160
159
|
:encrypt => @config[:capass],
|
161
160
|
:key => @config[:cakey],
|
162
161
|
:selfsign => true,
|
163
162
|
:ttl => ttl,
|
164
|
-
|
165
163
|
:type => :ca
|
166
164
|
)
|
167
165
|
|
@@ -241,19 +239,15 @@ class Puppet::SSLCertificates::CA
|
|
241
239
|
f << "%04X" % (serial + 1)
|
242
240
|
}
|
243
241
|
|
244
|
-
|
245
|
-
newcert = Puppet::SSLCertificates.mkcert(
|
246
|
-
|
242
|
+
newcert = Puppet::SSLCertificates.mkcert(
|
247
243
|
:type => :server,
|
248
244
|
:name => csr.subject,
|
249
245
|
:ttl => ttl,
|
250
246
|
:issuer => @cert,
|
251
247
|
:serial => serial,
|
252
|
-
|
253
248
|
:publickey => csr.public_key
|
254
249
|
)
|
255
250
|
|
256
|
-
|
257
251
|
sign_with_key(newcert)
|
258
252
|
|
259
253
|
self.storeclientcert(newcert)
|
data/lib/puppet/type.rb
CHANGED
@@ -965,7 +965,7 @@ class Type
|
|
965
965
|
the value, and any changes already get logged."
|
966
966
|
|
967
967
|
validate do |list|
|
968
|
-
list = Array(list)
|
968
|
+
list = Array(list).collect {|p| p.to_sym}
|
969
969
|
unless list == [:all]
|
970
970
|
list.each do |param|
|
971
971
|
next if @resource.class.validattr?(param)
|
@@ -990,8 +990,8 @@ class Type
|
|
990
990
|
end
|
991
991
|
|
992
992
|
def properties_to_audit(list)
|
993
|
-
if list == :all
|
994
|
-
list = all_properties
|
993
|
+
if !list.kind_of?(Array) && list.to_sym == :all
|
994
|
+
list = all_properties
|
995
995
|
else
|
996
996
|
list = Array(list).collect { |p| p.to_sym }
|
997
997
|
end
|
data/lib/puppet/type/cron.rb
CHANGED
data/lib/puppet/type/tidy.rb
CHANGED
data/lib/puppet/type/user.rb
CHANGED
@@ -24,9 +24,16 @@ module Puppet
|
|
24
24
|
"The provider can modify user passwords, by accepting a password
|
25
25
|
hash."
|
26
26
|
|
27
|
+
feature :manages_password_age,
|
28
|
+
"The provider can set age requirements and restrictions for
|
29
|
+
passwords."
|
30
|
+
|
27
31
|
feature :manages_solaris_rbac,
|
28
32
|
"The provider can manage roles and normal users"
|
29
33
|
|
34
|
+
feature :manages_expiry,
|
35
|
+
"The provider can manage the expiry date for a user."
|
36
|
+
|
30
37
|
newproperty(:ensure, :parent => Puppet::Property::Ensure) do
|
31
38
|
newvalue(:present, :event => :user_created) do
|
32
39
|
provider.create
|
@@ -157,6 +164,43 @@ module Puppet
|
|
157
164
|
end
|
158
165
|
end
|
159
166
|
|
167
|
+
newproperty(:password_min_age, :required_features => :manages_password_age) do
|
168
|
+
desc "The minimum amount of time in days a password must be used before it may be changed"
|
169
|
+
|
170
|
+
munge do |value|
|
171
|
+
case value
|
172
|
+
when String
|
173
|
+
Integer(value)
|
174
|
+
else
|
175
|
+
value
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
validate do |value|
|
180
|
+
if value.to_s !~ /^\d+$/
|
181
|
+
raise ArgumentError, "Password minimum age must be provided as a number"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
newproperty(:password_max_age, :required_features => :manages_password_age) do
|
187
|
+
desc "The maximum amount of time in days a password may be used before it must be changed"
|
188
|
+
|
189
|
+
munge do |value|
|
190
|
+
case value
|
191
|
+
when String
|
192
|
+
Integer(value)
|
193
|
+
else
|
194
|
+
value
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
validate do |value|
|
199
|
+
if value.to_s !~ /^\d+$/
|
200
|
+
raise ArgumentError, "Password maximum age must be provided as a number"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
160
204
|
|
161
205
|
newproperty(:groups, :parent => Puppet::Property::List) do
|
162
206
|
desc "The groups of which the user is a member. The primary
|
@@ -210,6 +254,17 @@ module Puppet
|
|
210
254
|
end
|
211
255
|
end
|
212
256
|
|
257
|
+
newproperty(:expiry, :required_features => :manages_expiry) do
|
258
|
+
desc "The expiry date for this user. Must be provided in
|
259
|
+
a zero padded YYYY-MM-DD format - e.g 2010-02-19."
|
260
|
+
|
261
|
+
validate do |value|
|
262
|
+
if value !~ /^\d{4}-\d{2}-\d{2}$/
|
263
|
+
raise ArgumentError, "Expiry dates must be YYYY-MM-DD"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
213
268
|
# Autorequire the group, if it's around
|
214
269
|
autorequire(:group) do
|
215
270
|
autos = []
|
data/lib/puppet/type/whit.rb
CHANGED
data/lib/puppet/util.rb
CHANGED
@@ -20,6 +20,14 @@ module Util
|
|
20
20
|
# Create a hash to store the different sync objects.
|
21
21
|
@@syncresources = {}
|
22
22
|
|
23
|
+
def self.activerecord_version
|
24
|
+
if (defined?(::ActiveRecord) and defined?(::ActiveRecord::VERSION) and defined?(::ActiveRecord::VERSION::MAJOR) and defined?(::ActiveRecord::VERSION::MINOR))
|
25
|
+
([::ActiveRecord::VERSION::MAJOR, ::ActiveRecord::VERSION::MINOR].join('.').to_f)
|
26
|
+
else
|
27
|
+
0
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
23
31
|
# Return the sync object associated with a given resource.
|
24
32
|
def self.sync(resource)
|
25
33
|
@@syncresources[resource] ||= Sync.new
|
data/lib/puppet/util/metric.rb
CHANGED
@@ -31,9 +31,12 @@ class Puppet::Util::Metric
|
|
31
31
|
|
32
32
|
start ||= Time.now.to_i - 5
|
33
33
|
|
34
|
-
@rrd = RRDtool.new(self.path)
|
35
34
|
args = []
|
36
35
|
|
36
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
37
|
+
@rrd = RRDtool.new(self.path)
|
38
|
+
end
|
39
|
+
|
37
40
|
values.each { |value|
|
38
41
|
# the 7200 is the heartbeat -- this means that any data that isn't
|
39
42
|
# more frequently than every two hours gets thrown away
|
@@ -42,14 +45,22 @@ class Puppet::Util::Metric
|
|
42
45
|
args.push "RRA:AVERAGE:0.5:1:300"
|
43
46
|
|
44
47
|
begin
|
45
|
-
|
48
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
49
|
+
@rrd.create( Puppet[:rrdinterval].to_i, start, args)
|
50
|
+
else
|
51
|
+
RRD.create( self.path, '-s', Puppet[:rrdinterval].to_i.to_s, '-b', start.to_i.to_s, *args)
|
52
|
+
end
|
46
53
|
rescue => detail
|
47
54
|
raise "Could not create RRD file #{path}: #{detail}"
|
48
55
|
end
|
49
56
|
end
|
50
57
|
|
51
58
|
def dump
|
52
|
-
|
59
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
60
|
+
puts @rrd.info
|
61
|
+
else
|
62
|
+
puts RRD.info(self.path)
|
63
|
+
end
|
53
64
|
end
|
54
65
|
|
55
66
|
def graph(range = nil)
|
@@ -82,14 +93,26 @@ class Puppet::Util::Metric
|
|
82
93
|
args << lines
|
83
94
|
args.flatten!
|
84
95
|
if range
|
85
|
-
|
96
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
97
|
+
args.push("--start",range[0],"--end",range[1])
|
98
|
+
else
|
99
|
+
args.push("--start",range[0].to_i.to_s,"--end",range[1].to_i.to_s)
|
100
|
+
end
|
86
101
|
else
|
87
|
-
|
102
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
103
|
+
args.push("--start", Time.now.to_i - time, "--end", Time.now.to_i)
|
104
|
+
else
|
105
|
+
args.push("--start", (Time.now.to_i - time).to_s, "--end", Time.now.to_i.to_s)
|
106
|
+
end
|
88
107
|
end
|
89
108
|
|
90
109
|
begin
|
91
110
|
#Puppet.warning "args = #{args}"
|
92
|
-
|
111
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
112
|
+
RRDtool.graph( args )
|
113
|
+
else
|
114
|
+
RRD.graph( *args )
|
115
|
+
end
|
93
116
|
rescue => detail
|
94
117
|
Puppet.err "Failed to graph #{self.name}: #{detail}"
|
95
118
|
end
|
@@ -114,13 +137,15 @@ class Puppet::Util::Metric
|
|
114
137
|
end
|
115
138
|
|
116
139
|
def store(time)
|
117
|
-
unless Puppet.features.rrd?
|
140
|
+
unless Puppet.features.rrd? || Puppet.features.rrd_legacy?
|
118
141
|
Puppet.warning "RRD library is missing; cannot store metrics"
|
119
142
|
return
|
120
143
|
end
|
121
144
|
self.create(time - 5) unless FileTest.exists?(self.path)
|
122
145
|
|
123
|
-
|
146
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
147
|
+
@rrd ||= RRDtool.new(self.path)
|
148
|
+
end
|
124
149
|
|
125
150
|
# XXX this is not terribly error-resistant
|
126
151
|
args = [time]
|
@@ -133,7 +158,11 @@ class Puppet::Util::Metric
|
|
133
158
|
arg = args.join(":")
|
134
159
|
template = temps.join(":")
|
135
160
|
begin
|
136
|
-
|
161
|
+
if Puppet.features.rrd_legacy? && ! Puppet.features.rrd?
|
162
|
+
@rrd.update( template, [ arg ] )
|
163
|
+
else
|
164
|
+
RRD.update( self.path, '-t', template, arg )
|
165
|
+
end
|
137
166
|
#system("rrdtool updatev #{self.path} '#{arg}'")
|
138
167
|
rescue => detail
|
139
168
|
raise Puppet::Error, "Failed to update #{self.name}: #{detail}"
|