puppet 2.6.2 → 2.6.3

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.

Files changed (83) hide show
  1. data/CHANGELOG +61 -0
  2. data/ext/envpuppet +80 -0
  3. data/ext/puppet-load.rb +62 -26
  4. data/ext/puppetstoredconfigclean.rb +0 -2
  5. data/lib/puppet.rb +1 -1
  6. data/lib/puppet/daemon.rb +2 -2
  7. data/lib/puppet/defaults.rb +10 -8
  8. data/lib/puppet/external/pson/pure/generator.rb +5 -12
  9. data/lib/puppet/indirector/catalog/compiler.rb +8 -4
  10. data/lib/puppet/network/handler/fileserver.rb +2 -0
  11. data/lib/puppet/network/server.rb +2 -2
  12. data/lib/puppet/node/environment.rb +4 -0
  13. data/lib/puppet/parser/ast/collection.rb +34 -51
  14. data/lib/puppet/parser/ast/leaf.rb +10 -2
  15. data/lib/puppet/parser/ast/resource.rb +4 -3
  16. data/lib/puppet/parser/compiler.rb +2 -2
  17. data/lib/puppet/parser/functions.rb +4 -2
  18. data/lib/puppet/parser/lexer.rb +2 -1
  19. data/lib/puppet/parser/parser_support.rb +3 -3
  20. data/lib/puppet/provider.rb +2 -2
  21. data/lib/puppet/provider/confine/exists.rb +1 -4
  22. data/lib/puppet/provider/mount.rb +1 -1
  23. data/lib/puppet/provider/nameservice.rb +3 -1
  24. data/lib/puppet/provider/package/openbsd.rb +6 -10
  25. data/lib/puppet/provider/service/freebsd.rb +4 -1
  26. data/lib/puppet/provider/service/launchd.rb +1 -1
  27. data/lib/puppet/provider/user/user_role_add.rb +8 -6
  28. data/lib/puppet/provider/user/useradd.rb +7 -8
  29. data/lib/puppet/rails.rb +2 -6
  30. data/lib/puppet/rails/host.rb +0 -72
  31. data/lib/puppet/resource.rb +22 -0
  32. data/lib/puppet/resource/type.rb +18 -13
  33. data/lib/puppet/type/exec.rb +1 -7
  34. data/lib/puppet/type/schedule.rb +5 -5
  35. data/lib/puppet/util.rb +20 -18
  36. data/lib/puppet/util/command_line.rb +1 -1
  37. data/lib/puppet/util/file_locking.rb +6 -3
  38. data/lib/puppet/util/metric.rb +1 -1
  39. data/lib/puppet/util/rdoc.rb +5 -4
  40. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +6 -0
  41. data/lib/puppet/util/reference.rb +1 -10
  42. data/lib/puppet/util/suidmanager.rb +1 -1
  43. data/lib/puppet/util/zaml.rb +4 -1
  44. data/spec/integration/indirector/bucket_file/rest_spec.rb +10 -2
  45. data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +10 -2
  46. data/spec/integration/parser/functions_spec.rb +21 -0
  47. data/spec/integration/parser/ruby_manifest_spec.rb +1 -1
  48. data/spec/integration/ssl/certificate_authority_spec.rb +1 -3
  49. data/spec/integration/util/file_locking_spec.rb +31 -11
  50. data/spec/spec_helper.rb +1 -1
  51. data/spec/unit/application/apply_spec.rb +1 -1
  52. data/spec/unit/daemon_spec.rb +3 -9
  53. data/spec/unit/indirector/catalog/compiler_spec.rb +9 -8
  54. data/spec/unit/network/handler/fileserver_spec.rb +2 -4
  55. data/spec/unit/network/server_spec.rb +3 -10
  56. data/spec/unit/parser/ast/collection_spec.rb +4 -0
  57. data/spec/unit/parser/ast/leaf_spec.rb +43 -1
  58. data/spec/unit/parser/ast/resource_spec.rb +133 -88
  59. data/spec/unit/parser/compiler_spec.rb +8 -8
  60. data/spec/unit/parser/lexer_spec.rb +1 -0
  61. data/spec/unit/parser/parser_spec.rb +9 -2
  62. data/spec/unit/provider/confine/exists_spec.rb +6 -13
  63. data/spec/unit/provider/mount_spec.rb +8 -1
  64. data/spec/unit/provider/service/freebsd_spec.rb +50 -0
  65. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -2
  66. data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
  67. data/spec/unit/provider/user/useradd_spec.rb +42 -0
  68. data/spec/unit/rails_spec.rb +82 -22
  69. data/spec/unit/resource/type_spec.rb +13 -13
  70. data/spec/unit/type/schedule_spec.rb +21 -49
  71. data/spec/unit/util/command_line_spec.rb +2 -2
  72. data/spec/unit/util/file_locking_spec.rb +28 -24
  73. data/spec/unit/util/{json_spec.rb → pson_spec.rb} +17 -0
  74. data/spec/unit/util/rdoc_spec.rb +9 -1
  75. data/spec/unit/util/storage_spec.rb +2 -3
  76. data/test/other/provider.rb +1 -12
  77. data/test/other/report.rb +2 -5
  78. data/test/puppet/tc_suidmanager.rb +5 -14
  79. data/test/ral/manager/type.rb +1 -1
  80. data/test/ral/providers/provider.rb +3 -3
  81. data/test/util/metrics.rb +2 -2
  82. metadata +8 -6
  83. data/spec/integration/indirector/rest_spec.rb +0 -525
data/CHANGELOG CHANGED
@@ -1,5 +1,66 @@
1
+ 2.6.3
2
+ =====
3
+ 184733c [#5322] (#5322) Remove spec file that adds little value and causes failures
4
+ 178c2a6 Fix test failures that fixing #4726 exposed.
5
+ 74b6c09 (#4726) Fix RRD legacy support
6
+ 8662056 Fix for #4279 -- mount detection on HP-UX
7
+ fbb096a Fix for #5055 -- adding to_sym to Puppet::Node::Environment
8
+ b2ff6a5 Fix for #5298 -- Collections need to do type lookup
9
+ 1ce00dc Step towards [5298] -- cleanup indentation, etc. in AST::Collection
10
+ 722608b Fixed #5287 - Schedule documentation is incorrect
11
+ c8b6fb5 Fixed #5296 - test warnings messages
12
+ d221c05 (#5297) Fix schedule tests that were missing stubs for Time.now
13
+ f2fd0d1 Fix for #5273 -- user resource constantly resetting password age
14
+ 544dcf8 Fix #5289 -- Bad copy/paste changes message on test failure
15
+
16
+ 2.6.3rc3
17
+ ========
18
+ 126681f Updated CHANGELOG for 2.6.3rc3
19
+ b15231d Fix for #4299 -- Don't require which
20
+ ea435a4 Fix #5020 - Prefer finding node name from REST uri over certname
21
+ a097b93 Fix for #4894 -- retry tests if port is in use
22
+ ee61b4e Fix for #4955 -- Race condition & memory leak in Puppet::Util
23
+ f57425d Fix #4921 - race condition in Parser Functions creation
24
+ 9604f1c Fix #5252 - line number mis-attribution during parsing
25
+ cc5224c Maint. fix for test broken by 00eedac5
26
+ 5f7d0fb Fix for #2568 -- Add a dbconnections option to set AR pool size
27
+ ba4d22b Maint. Removing code for which no CLA has been signed
28
+ 4a3d5d7 Reimplementation of functionality removed by prior commit
29
+ 235d641 Refactor for CLA
30
+ 9ba0c8a Fix #4923 - close process race when truncating existing file
31
+ cb16d3d Puppet-load: better and safer error reporting
32
+ 1d26742 Fix #5023 - puppet-load multiple nodes support
33
+ 00eedac capture stderr from exec resources
34
+ 4cbceab (#4573) FreeBSD service provider now supports versions <7 and >8
35
+ 06c8748 Fix #3808 - puppetdoc should use --force-update only if RDoc supports it
36
+ 6e6712b [#4813] Remove dead code from puppet/rails/host.rb
37
+ 956296a Fix #4911 - Do not generate doc for standard RDoc parser generated object
38
+ 4fa24bb Fix #5127 - error when accessing array elements
39
+ abb8c66 (#5242) Fix schedule specs that fail near daylight savings
40
+ ec667fd Kludge for #5206 -- port of fix for #3536 to yaml
41
+ 9a3b584 (#5062) Add envpuppet helper script to ext/
42
+ aad7008 [#5225] Fix spec failure that depended on time change
43
+ 21db472 (#5233) Randomize tmp dir paths
44
+
45
+ 2.6.3rc2
46
+ ========
47
+ 244213c Updated CHANGELOG for 2.6.3rc2
48
+ 76ac1f8 Fixed #5112 - Launchd Service broke in 2.6.2 with OS X 10.4 Clients.
49
+ 776ea2a Fixed #5137 - Removed no longer required TOC references
50
+ 31118fe Kludge for #5048 -- serialization compatibility with 0.25.x
51
+ 65ef24e (#4534/#4778) -- Normalize parameterized classes
52
+ 3b53bfc Fix for #5022 -- Escaped newlines should be elided
53
+
54
+ 2.6.3rc1
55
+ ========
56
+ e3fc5b9 Updated CHANGELOG and version for 2.6.3rc1
57
+ 3c56705 Fix for #4832 -- Making PSON handle arbitrary binary data
58
+ e232770 Minimal fix for #4975 -- only call chage when managing password age rules
59
+ a090e86 Fix for #4963 -- Use correct commands for password expiry on solaris
60
+
1
61
  2.6.2
2
62
  =====
63
+ 295c3be Updated CHANGELOG for 2.6.2
3
64
  1d719be Fix for #4945 -- explicitly check os to supress man page installation
4
65
  55417bc Reversion of 021d534482dd8edb863cb77d668ac3525362a0a6
5
66
  a6e2bea Fixed #4919 - added parenths to fix error message:
@@ -0,0 +1,80 @@
1
+ #! /bin/bash
2
+ #
3
+ # Jeff McCune <jeff@puppetlabs.com>
4
+ # 2010-10-20
5
+ #
6
+ # Copyright (c) 2010, Puppet Labs
7
+ # License: BSD 3-clause license
8
+ #
9
+ # This script provides a simple way to execute puppet and related tools
10
+ # directly from a git clone of the upstream repositories. This allows you to
11
+ # quickly switch branches and test different versions of code without much
12
+ # friction.
13
+ #
14
+ # NOTE: There may be issues if puppet, facter, etc... are already installed
15
+ # into RUBY's site_ruby directory. If you run into strange problems, make sure
16
+ # the correct ruby libraries are being loaded...
17
+ #
18
+ # Sample Usage:
19
+ # =============
20
+ # cd ~/src
21
+ # git clone git://github.com/puppetlabs/puppet.git
22
+ # git clone git://github.com/puppetlabs/facter.git
23
+ # pushd puppet
24
+ # git checkout tags/2.6.1
25
+ # popd
26
+ # pushd facter
27
+ # git checkout tags/1.5.8
28
+ # export ENVPUPPET_BASEDIR=/home/jeff/src
29
+ # envpuppet puppet --version
30
+ # 2.6.1
31
+ # envpuppet facter --version
32
+ # 1.5.8
33
+
34
+ set -e
35
+ set -u
36
+
37
+ if test -d puppet -o -d facter; then
38
+ echo " WARNING!"
39
+ echo " Strange things happen if puppet or facter are in the"
40
+ echo " current working directory"
41
+ echo " (import errors from ruby are a prime example)"
42
+ echo " WARNING!"
43
+ echo ""
44
+ echo "I suggest changing to ~ or /tmp or something..."
45
+ echo ""
46
+ echo "Sleeping 2 seconds."
47
+ echo ""
48
+ sleep 2
49
+ fi
50
+
51
+ # Set this to where you check out puppet and facter
52
+ : ${ENVPUPPET_BASEDIR:="${HOME}/src"}
53
+
54
+ # git://github.com/reductivelabs/puppet.git
55
+ mypath="${ENVPUPPET_BASEDIR}/puppet/sbin:${ENVPUPPET_BASEDIR}/puppet/bin"
56
+ myrubylib="${ENVPUPPET_BASEDIR}/puppet/lib"
57
+
58
+ # git://github.com/reductivelabs/facter.git
59
+ mypath="${mypath}:${ENVPUPPET_BASEDIR}/facter/bin"
60
+ myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/facter/lib"
61
+
62
+ # http://github.com/jamtur01/puppet-scaffold.git
63
+ mypath="${mypath}:${ENVPUPPET_BASEDIR}/puppet-scaffold/bin"
64
+ myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/puppet-scaffold/lib"
65
+
66
+ # http://github.com/puppetlabs/puppet-module-tool.git
67
+ # Also known as "pmt" Will become "puppet module"
68
+ mypath="${mypath}:${ENVPUPPET_BASEDIR}/puppet-module-tool/bin"
69
+ myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/puppet-module-tool/lib"
70
+
71
+ # Use the existing environment, if present.
72
+ # Default to no value to prevent unbound variable issues
73
+ mypath="${mypath}:${PATH:-}"
74
+ myrubylib="${myrubylib}:${RUBYLIB:-}"
75
+
76
+ # Trim any trailing colons from the path list.
77
+ export PATH="${mypath%%:}"
78
+ export RUBYLIB="${myrubylib%%:}"
79
+
80
+ exec "$@"
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # puppet-load [-d|--debug] [--concurrency <num>] [--repeat <num>] [-V|--version] [-v|--verbose]
16
16
  # [--node <host.domain.com>] [--facts <factfile>] [--cert <certfile>] [--key <keyfile>]
17
- # [--server <server.domain.com>]
17
+ # [--factsdir <factsdir>] [--server <server.domain.com>]
18
18
  #
19
19
  # = Description
20
20
  #
@@ -35,8 +35,9 @@
35
35
  # Set the puppet master hostname or IP address..
36
36
  #
37
37
  # node::
38
- # Set the fully-qualified domain name of the client. This is only used for
39
- # certificate purposes, but can be used to override the discovered hostname.
38
+ # Set the fully-qualified domain name of the client. This option can be given multiple
39
+ # times. In this case puppet-load will ask for catalog compilation of all the given nodes
40
+ # on a round robin way.
40
41
  #
41
42
  # help::
42
43
  # Print this help message
@@ -46,6 +47,11 @@
46
47
  # file as found in the clientyaml directory. If none are provided, puppet-load
47
48
  # will look by itself using Puppet facts indirector.
48
49
  #
50
+ # factsdir::
51
+ # Specify a directory where the yaml facts files can be found. If provided puppet-load
52
+ # will look up facts in this directory. If not found it will resort to using Puppet Facts
53
+ # indirector.
54
+ #
49
55
  # cert::
50
56
  # This option is mandatory. It should be set to the cert PEM file that will be used
51
57
  # to quthenticate the client connections.
@@ -70,8 +76,9 @@
70
76
  #
71
77
  # = Example usage
72
78
  #
79
+ # SINGLE NODE:
73
80
  # 1) On the master host, generate a new certificate and private key for our test host:
74
- # puppet ca --generate puppet-load.domain.com [*]
81
+ # puppet ca --generate puppet-load.domain.com
75
82
  #
76
83
  # 2) Copy the cert and key to the puppet-load host (which can be the same as the master one)
77
84
  #
@@ -81,7 +88,7 @@
81
88
  # allow $1
82
89
  # allow puppet-load.domain.com
83
90
  #
84
- # 4) launch the master
91
+ # 4) launch the master(s)
85
92
  #
86
93
  # 5) Prepare or get a fact file. One way to get one is to look on the master in $vardir/yaml/ for the host
87
94
  # you want to simulate.
@@ -89,12 +96,30 @@
89
96
  # 5) launch puppet-load
90
97
  # puppet-load -debug --node server.domain.com --server master.domain.com --facts server.domain.com.yaml --concurrency 2 --repeat 20
91
98
  #
92
- # [*]: unfortunately at this stage Puppet trusts the certname of the connecting node more than
93
- # than the node name request paramater. It means that the master will compile
94
- # the puppet-load node and not the --node given.
99
+ # MULTIPLE NODES:
100
+ # 1) On the master host, generate a new certificate and private key for our test host:
101
+ # puppet ca --generate puppet-load.domain.com
102
+ #
103
+ # 2) Copy the cert and key to the puppet-load host (which can be the same as the master one)
104
+ #
105
+ # 3) On the master host edit or create the auth.conf so that the catalog ACL match:
106
+ # path ~ ^/catalog/([^/]+)$
107
+ # method find
108
+ # allow $1
109
+ # allow puppet-load.domain.com
110
+ #
111
+ # 4) launch the master(s)
112
+ #
113
+ # 5) Prepare or get a fact file. One way to get one is to look on the master in $vardir/yaml/ for the host
114
+ # you want to simulate.
115
+ #
116
+ # 5) launch puppet-load
117
+ # puppet-load -debug --node server1.domain.com --node server2.domain.com --node server3.domain.com \
118
+ # --server master.domain.com --factsdir /var/lib/puppet/yaml/facts --concurrency 2 --repeat 20
119
+ #
120
+ # puppet-load will load facts file in the --factsdir directory based on the node name.
95
121
  #
96
122
  # = TODO
97
- # * Allow to simulate any different nodes
98
123
  # * More output stats for error connections (ie report errors, HTTP code...)
99
124
  #
100
125
  #
@@ -115,6 +140,7 @@ $cmdargs = [
115
140
  [ "--concurrency", "-c", GetoptLong::REQUIRED_ARGUMENT ],
116
141
  [ "--node", "-n", GetoptLong::REQUIRED_ARGUMENT ],
117
142
  [ "--facts", GetoptLong::REQUIRED_ARGUMENT ],
143
+ [ "--factsdir", GetoptLong::REQUIRED_ARGUMENT ],
118
144
  [ "--repeat", "-r", GetoptLong::REQUIRED_ARGUMENT ],
119
145
  [ "--cert", "-C", GetoptLong::REQUIRED_ARGUMENT ],
120
146
  [ "--key", "-k", GetoptLong::REQUIRED_ARGUMENT ],
@@ -131,14 +157,15 @@ Puppet::Util::Log.newdestination(:console)
131
157
  times = {}
132
158
 
133
159
  def read_facts(file)
134
- YAML.load(File.read(file))
160
+ Puppet.debug("reading facts from: #{file}")
161
+ fact = YAML.load(File.read(file))
135
162
  end
136
163
 
137
164
 
138
165
  result = GetoptLong.new(*$cmdargs)
139
166
 
140
167
  $args = {}
141
- $options = {:repeat => 1, :concurrency => 1, :pause => false, :cert => nil, :key => nil, :timeout => 180, :masterport => 8140}
168
+ $options = {:repeat => 1, :concurrency => 1, :pause => false, :cert => nil, :key => nil, :timeout => 180, :masterport => 8140, :node => [], :factsdir => nil}
142
169
 
143
170
  begin
144
171
  result.each { |opt,arg|
@@ -151,7 +178,9 @@ begin
151
178
  exit(14)
152
179
  end
153
180
  when "--node"
154
- $options[:node] = arg
181
+ $options[:node] << arg
182
+ when "--factsdir"
183
+ $options[:factsdir] = arg
155
184
  when "--server"
156
185
  $options[:server] = arg
157
186
  when "--masterport"
@@ -192,21 +221,24 @@ unless $options[:cert] and $options[:key]
192
221
  raise "--cert and --key are mandatory to authenticate the client"
193
222
  end
194
223
 
195
- unless $options[:facts] and facts = read_facts($options[:facts])
196
- unless facts = Puppet::Node::Facts.find($options[:node])
197
- raise "Could not find facts for %s" % $options[:node]
198
- end
199
- end
224
+ parameters = []
200
225
 
201
- unless $options[:node]
226
+ unless $options[:node].size > 0
202
227
  raise "--node is a mandatory argument. It tells to the master what node to compile"
203
228
  end
204
229
 
205
- facts.values["fqdn"] = $options[:node]
206
- facts.values["hostname"] = $options[:node].sub(/\..+/, '')
207
- facts.values["domain"] = $options[:node].sub(/^[^.]+\./, '')
230
+ $options[:node].each do |node|
231
+ factfile = $options[:factsdir] ? File.join($options[:factsdir], node + ".yaml") : $options[:facts]
232
+ unless fact = read_facts(factfile) or fact = Puppet::Node::Facts.find(node)
233
+ raise "Could not find facts for %s" % node
234
+ end
235
+ fact.values["fqdn"] = node
236
+ fact.values["hostname"] = node.sub(/\..+/, '')
237
+ fact.values["domain"] = node.sub(/^[^.]+\./, '')
238
+
239
+ parameters << {:facts_format => "b64_zlib_yaml", :facts => CGI.escape(fact.render(:b64_zlib_yaml))}
240
+ end
208
241
 
209
- parameters = {:facts_format => "b64_zlib_yaml", :facts => CGI.escape(facts.render(:b64_zlib_yaml))}
210
242
 
211
243
  class RequestPool
212
244
  include EventMachine::Deferrable
@@ -233,17 +265,21 @@ class RequestPool
233
265
  end
234
266
 
235
267
  def spawn_request(index)
236
- EventMachine::HttpRequest.new("https://#{$options[:server]}:#{$options[:masterport]}/production/catalog/#{$options[:node]}").get(
268
+ @times[index] = Time.now
269
+ @sizes[index] = 0
270
+ nodeidx = index % $options[:node].size
271
+ node = $options[:node][nodeidx]
272
+ EventMachine::HttpRequest.new("https://#{$options[:server]}:#{$options[:masterport]}/production/catalog/#{node}").get(
237
273
  :port => $options[:masterport],
238
- :query => @parameters,
274
+ :query => @parameters[nodeidx],
239
275
  :timeout => $options[:timeout],
240
276
  :head => { "Accept" => "pson, yaml, b64_zlib_yaml, marshal, dot, raw", "Accept-Encoding" => "gzip, deflate" },
241
277
  :ssl => { :private_key_file => $options[:key],
242
278
  :cert_chain_file => $options[:cert],
243
279
  :verify_peer => false } ) do
244
- Puppet.debug("starting client #{index}")
245
280
  @times[index] = Time.now
246
281
  @sizes[index] = 0
282
+ Puppet.debug("starting client #{index} for #{node}")
247
283
  end
248
284
  end
249
285
 
@@ -268,7 +304,7 @@ class RequestPool
268
304
  }
269
305
 
270
306
  conn.errback {
271
- Puppet.debug("Client #{index} finished with an error: #{conn.response.error}")
307
+ Puppet.debug("Client #{index} finished with an error: #{conn.error}")
272
308
  @times[index] = Time.now - @times[index]
273
309
  @responses[:failed].push(conn)
274
310
  check_progress
@@ -70,8 +70,6 @@ case adapter
70
70
  args[:port] = pm_conf[:dbport] unless pm_conf[:dbport].to_s.empty?
71
71
  socket = pm_conf[:dbsocket]
72
72
  args[:socket] = socket unless socket.to_s.empty?
73
- connections = pm_conf[:dbconnections].to_i
74
- args[:pool] = connections if connections > 0
75
73
  else
76
74
  raise ArgumentError, "Invalid db adapter #{adapter}"
77
75
  end
@@ -24,7 +24,7 @@ require 'puppet/util/run_mode'
24
24
  # it's also a place to find top-level commands like 'debug'
25
25
 
26
26
  module Puppet
27
- PUPPETVERSION = '2.6.2'
27
+ PUPPETVERSION = '2.6.3'
28
28
 
29
29
  def Puppet.version
30
30
  PUPPETVERSION
@@ -43,7 +43,7 @@ class Puppet::Daemon
43
43
  # Create a pidfile for our daemon, so we can be stopped and others
44
44
  # don't try to start.
45
45
  def create_pidfile
46
- Puppet::Util.sync(Puppet[:name]).synchronize(Sync::EX) do
46
+ Puppet::Util.synchronize_on(Puppet[:name],Sync::EX) do
47
47
  raise "Could not create PID file: #{pidfile}" unless Puppet::Util::Pidlock.new(pidfile).lock
48
48
  end
49
49
  end
@@ -73,7 +73,7 @@ class Puppet::Daemon
73
73
 
74
74
  # Remove the pid file for our daemon.
75
75
  def remove_pidfile
76
- Puppet::Util.sync(Puppet[:name]).synchronize(Sync::EX) do
76
+ Puppet::Util.synchronize_on(Puppet[:name],Sync::EX) do
77
77
  locker = Puppet::Util::Pidlock.new(pidfile)
78
78
  locker.unlock or Puppet.err "Could not remove PID file #{pidfile}" if locker.locked?
79
79
  end
@@ -453,6 +453,12 @@ module Puppet
453
453
  :reporturl => ["http://localhost:3000/reports",
454
454
  "The URL used by the http reports processor to send reports"],
455
455
  :fileserverconfig => ["$confdir/fileserver.conf", "Where the fileserver configuration is stored."],
456
+ :strict_hostname_checking => [false, "Whether to only search for the complete
457
+ hostname as it is in the certificate when searching for node information
458
+ in the catalogs."]
459
+ )
460
+
461
+ setdefaults(:metrics,
456
462
  :rrddir => {:default => "$vardir/rrd",
457
463
  :owner => "service",
458
464
  :group => "service",
@@ -461,10 +467,7 @@ module Puppet
461
467
  this directory."
462
468
  },
463
469
  :rrdinterval => ["$runinterval", "How often RRD should expect data.
464
- This should match how often the hosts report back to the server."],
465
- :strict_hostname_checking => [false, "Whether to only search for the complete
466
- hostname as it is in the certificate when searching for node information
467
- in the catalogs."]
470
+ This should match how often the hosts report back to the server."]
468
471
  )
469
472
 
470
473
  setdefaults(:agent,
@@ -637,7 +640,7 @@ module Puppet
637
640
  setdefaults(
638
641
  :tagmail,
639
642
  :tagmap => ["$confdir/tagmail.conf", "The mapping between reporting tags and email addresses."],
640
- :sendmail => [%x{which sendmail 2>/dev/null}.chomp, "Where to find the sendmail binary with which to send email."],
643
+ :sendmail => [which('sendmail') || '', "Where to find the sendmail binary with which to send email."],
641
644
 
642
645
  :reportfrom => ["report@" + [Facter["hostname"].value, Facter["domain"].value].join("."), "The 'from' email address for the reports."],
643
646
  :smtpserver => ["none", "The server through which to send email reports."]
@@ -663,11 +666,10 @@ module Puppet
663
666
  used when networked databases are used."],
664
667
  :dbpassword => [ "puppet", "The database password for caching. Only
665
668
  used when networked databases are used."],
669
+ :dbconnections => [ '', "The number of database connections for networked
670
+ databases. Will be ignored unless the value is a positive integer."],
666
671
  :dbsocket => [ "", "The database socket location. Only used when networked
667
672
  databases are used. Will be ignored if the value is an empty string."],
668
- :dbconnections => [ 0, "The number of database connections. Only used when
669
- networked databases are used. Will be ignored if the value is an empty
670
- string or is less than 1."],
671
673
  :railslog => {:default => "$logdir/rails.log",
672
674
  :mode => 0600,
673
675
  :owner => "service",
@@ -63,22 +63,15 @@ module PSON
63
63
  end
64
64
  else
65
65
  def utf8_to_pson(string) # :nodoc:
66
- string = string.gsub(/["\\\x0-\x1f]/) { MAP[$MATCH] }
67
- string.gsub!(/(
68
- (?:
66
+ string.
67
+ gsub(/["\\\x0-\x1f]/n) { MAP[$MATCH] }.
68
+ gsub(/((?:
69
69
  [\xc2-\xdf][\x80-\xbf] |
70
70
  [\xe0-\xef][\x80-\xbf]{2} |
71
71
  [\xf0-\xf4][\x80-\xbf]{3}
72
- )+ |
73
- [\x80-\xc1\xf5-\xff] # invalid
74
- )/nx) { |c|
75
- c.size == 1 and raise GeneratorError, "invalid utf8 byte: '#{c}'"
76
- s = PSON::UTF8toUTF16.iconv(c).unpack('H*')[0]
77
- s.gsub!(/.{4}/n, '\\\\u\&')
72
+ )+)/nx) { |c|
73
+ PSON::UTF8toUTF16.iconv(c).unpack('H*')[0].gsub(/.{4}/n, '\\\\u\&')
78
74
  }
79
- string
80
- rescue Iconv::Failure => e
81
- raise GeneratorError, "Caught #{e.class}: #{e}"
82
75
  end
83
76
  end
84
77
  module_function :utf8_to_pson