puppet 2.7.11 → 2.7.12

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 (220) hide show
  1. data/CHANGELOG +188 -0
  2. data/conf/osx/createpackage.sh +1 -0
  3. data/conf/redhat/puppet.spec +12 -9
  4. data/conf/suse/puppet.spec +4 -1
  5. data/install.rb +9 -22
  6. data/lib/puppet.rb +1 -31
  7. data/lib/puppet/agent.rb +3 -5
  8. data/lib/puppet/agent/locker.rb +15 -1
  9. data/lib/puppet/application.rb +7 -4
  10. data/lib/puppet/application/agent.rb +4 -25
  11. data/lib/puppet/application/apply.rb +3 -3
  12. data/lib/puppet/application/device.rb +2 -16
  13. data/lib/puppet/application/doc.rb +2 -2
  14. data/lib/puppet/application/face_base.rb +22 -5
  15. data/lib/puppet/application/filebucket.rb +2 -0
  16. data/lib/puppet/application/inspect.rb +2 -1
  17. data/lib/puppet/application/kick.rb +25 -9
  18. data/lib/puppet/application/queue.rb +0 -23
  19. data/lib/puppet/configurer.rb +1 -0
  20. data/lib/puppet/configurer/downloader.rb +7 -3
  21. data/lib/puppet/defaults.rb +34 -29
  22. data/lib/puppet/face/ca.rb +1 -1
  23. data/lib/puppet/face/catalog.rb +1 -0
  24. data/lib/puppet/face/file/store.rb +1 -1
  25. data/lib/puppet/face/module/list.rb +23 -3
  26. data/lib/puppet/face/module/search.rb +21 -32
  27. data/lib/puppet/face/module/uninstall.rb +56 -15
  28. data/lib/puppet/file_bucket/dipper.rb +2 -2
  29. data/lib/puppet/file_serving/base.rb +6 -5
  30. data/lib/puppet/file_serving/configuration/parser.rb +1 -1
  31. data/lib/puppet/file_serving/content.rb +1 -1
  32. data/lib/puppet/forge.rb +153 -0
  33. data/lib/puppet/{module_tool → forge}/cache.rb +1 -2
  34. data/lib/puppet/{module_tool → forge}/repository.rb +46 -4
  35. data/lib/puppet/indirector/exec.rb +1 -1
  36. data/lib/puppet/indirector/file_bucket_file/file.rb +3 -3
  37. data/lib/puppet/interface/action.rb +6 -2
  38. data/lib/puppet/module.rb +70 -10
  39. data/lib/puppet/module_tool.rb +2 -38
  40. data/lib/puppet/module_tool/applications.rb +15 -11
  41. data/lib/puppet/module_tool/applications/application.rb +2 -5
  42. data/lib/puppet/module_tool/applications/cleaner.rb +1 -1
  43. data/lib/puppet/module_tool/applications/installer.rb +10 -45
  44. data/lib/puppet/module_tool/applications/searcher.rb +2 -26
  45. data/lib/puppet/module_tool/applications/uninstaller.rb +39 -13
  46. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  47. data/lib/puppet/module_tool/dependency.rb +1 -1
  48. data/lib/puppet/network/authconfig.rb +1 -1
  49. data/lib/puppet/network/handler/fileserver.rb +1 -1
  50. data/lib/puppet/network/http/handler.rb +4 -1
  51. data/lib/puppet/network/http/webrick.rb +4 -2
  52. data/lib/puppet/node/environment.rb +32 -6
  53. data/lib/puppet/parameter/path.rb +0 -4
  54. data/lib/puppet/parser/ast/relationship.rb +3 -16
  55. data/lib/puppet/parser/collector.rb +5 -3
  56. data/lib/puppet/parser/compiler.rb +2 -1
  57. data/lib/puppet/parser/functions/file.rb +1 -1
  58. data/lib/puppet/parser/functions/generate.rb +8 -2
  59. data/lib/puppet/parser/grammar.ra +16 -15
  60. data/lib/puppet/parser/parser.rb +959 -881
  61. data/lib/puppet/parser/relationship.rb +32 -15
  62. data/lib/puppet/parser/resource.rb +0 -1
  63. data/lib/puppet/parser/type_loader.rb +1 -2
  64. data/lib/puppet/provider/augeas/augeas.rb +17 -29
  65. data/lib/puppet/provider/exec/windows.rb +25 -3
  66. data/lib/puppet/provider/file/posix.rb +1 -1
  67. data/lib/puppet/provider/file/windows.rb +1 -1
  68. data/lib/puppet/provider/group/windows_adsi.rb +1 -1
  69. data/lib/puppet/provider/package/aix.rb +1 -1
  70. data/lib/puppet/provider/package/appdmg.rb +1 -1
  71. data/lib/puppet/provider/package/dpkg.rb +1 -1
  72. data/lib/puppet/provider/package/gem.rb +21 -23
  73. data/lib/puppet/provider/package/macports.rb +1 -1
  74. data/lib/puppet/provider/package/msi.rb +7 -1
  75. data/lib/puppet/provider/package/openbsd.rb +13 -16
  76. data/lib/puppet/provider/package/pacman.rb +1 -1
  77. data/lib/puppet/provider/package/pip.rb +3 -0
  78. data/lib/puppet/provider/package/pkg.rb +1 -1
  79. data/lib/puppet/provider/package/pkgdmg.rb +1 -1
  80. data/lib/puppet/provider/package/pkgutil.rb +1 -1
  81. data/lib/puppet/provider/package/portage.rb +2 -2
  82. data/lib/puppet/provider/package/rpm.rb +1 -1
  83. data/lib/puppet/provider/package/sun.rb +1 -1
  84. data/lib/puppet/provider/package/zypper.rb +35 -3
  85. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +6 -2
  86. data/lib/puppet/provider/selmodule/semodule.rb +2 -2
  87. data/lib/puppet/provider/service/base.rb +1 -1
  88. data/lib/puppet/provider/service/launchd.rb +4 -0
  89. data/lib/puppet/provider/service/src.rb +2 -2
  90. data/lib/puppet/provider/service/upstart.rb +1 -1
  91. data/lib/puppet/provider/service/windows.rb +5 -4
  92. data/lib/puppet/provider/user/aix.rb +3 -3
  93. data/lib/puppet/provider/user/pw.rb +6 -0
  94. data/lib/puppet/provider/user/windows_adsi.rb +1 -1
  95. data/lib/puppet/resource/catalog.rb +6 -6
  96. data/lib/puppet/resource/type.rb +2 -0
  97. data/lib/puppet/ssl/certificate_request.rb +0 -70
  98. data/lib/puppet/transaction.rb +1 -1
  99. data/lib/puppet/transaction/report.rb +3 -2
  100. data/lib/puppet/type.rb +1 -1
  101. data/lib/puppet/type/cron.rb +5 -2
  102. data/lib/puppet/type/exec.rb +8 -0
  103. data/lib/puppet/type/file.rb +27 -18
  104. data/lib/puppet/type/file/checksum.rb +2 -2
  105. data/lib/puppet/type/file/content.rb +14 -9
  106. data/lib/puppet/type/file/ensure.rb +5 -4
  107. data/lib/puppet/type/file/group.rb +10 -2
  108. data/lib/puppet/type/file/mode.rb +46 -18
  109. data/lib/puppet/type/file/owner.rb +10 -2
  110. data/lib/puppet/type/file/source.rb +27 -40
  111. data/lib/puppet/type/file/target.rb +6 -6
  112. data/lib/puppet/type/group.rb +13 -9
  113. data/lib/puppet/type/k5login.rb +1 -1
  114. data/lib/puppet/type/package.rb +24 -8
  115. data/lib/puppet/type/scheduled_task.rb +77 -131
  116. data/lib/puppet/type/service.rb +22 -8
  117. data/lib/puppet/type/user.rb +29 -9
  118. data/lib/puppet/util.rb +24 -33
  119. data/lib/puppet/util/colors.rb +98 -0
  120. data/lib/puppet/util/diff.rb +3 -1
  121. data/lib/puppet/util/log.rb +5 -1
  122. data/lib/puppet/util/log/destinations.rb +37 -44
  123. data/lib/puppet/util/monkey_patches.rb +32 -0
  124. data/lib/puppet/util/pidlock.rb +70 -21
  125. data/lib/puppet/util/rdoc/parser.rb +4 -2
  126. data/lib/puppet/util/selinux.rb +1 -1
  127. data/lib/puppet/util/suidmanager.rb +2 -12
  128. data/lib/puppet/util/windows.rb +2 -0
  129. data/lib/puppet/util/windows/process.rb +33 -0
  130. data/lib/puppet/util/windows/security.rb +6 -4
  131. data/lib/puppet/util/windows/user.rb +44 -0
  132. data/lib/semver.rb +55 -4
  133. data/spec/fixtures/unit/provider/package/openbsd/pkginfo.detail +19 -0
  134. data/spec/fixtures/unit/provider/package/openbsd/pkginfo.list +10 -0
  135. data/spec/fixtures/unit/provider/package/openbsd/pkginfo.query +1 -0
  136. data/spec/fixtures/unit/provider/package/zypper/zypper-list-updates-SLES11sp1.out +369 -0
  137. data/spec/integration/defaults_spec.rb +10 -0
  138. data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
  139. data/spec/integration/module_tool_spec.rb +10 -12
  140. data/spec/integration/parser/compiler_spec.rb +147 -0
  141. data/spec/integration/type/file_spec.rb +1 -1
  142. data/spec/integration/util/windows/user_spec.rb +59 -0
  143. data/spec/lib/puppet/face/basetest.rb +5 -0
  144. data/spec/lib/puppet_spec/modules.rb +26 -0
  145. data/spec/spec_helper.rb +25 -0
  146. data/spec/unit/agent/locker_spec.rb +12 -0
  147. data/spec/unit/agent_backward_compatibility_spec.rb +152 -0
  148. data/spec/unit/agent_spec.rb +28 -8
  149. data/spec/unit/application/agent_spec.rb +4 -36
  150. data/spec/unit/application/device_spec.rb +55 -10
  151. data/spec/unit/application/face_base_spec.rb +32 -10
  152. data/spec/unit/application/filebucket_spec.rb +5 -0
  153. data/spec/unit/application/kick_spec.rb +6 -0
  154. data/spec/unit/application_spec.rb +8 -1
  155. data/spec/unit/configurer/downloader_spec.rb +4 -5
  156. data/spec/unit/face/ca_spec.rb +15 -4
  157. data/spec/unit/file_bucket/dipper_spec.rb +1 -1
  158. data/spec/unit/file_serving/base_spec.rb +60 -42
  159. data/spec/unit/file_serving/configuration/parser_spec.rb +5 -3
  160. data/spec/unit/file_serving/content_spec.rb +26 -27
  161. data/spec/unit/file_serving/metadata_spec.rb +22 -21
  162. data/spec/unit/forge/repository_spec.rb +86 -0
  163. data/spec/unit/forge_spec.rb +114 -0
  164. data/spec/unit/indirector/exec_spec.rb +8 -6
  165. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +0 -1
  166. data/spec/unit/indirector/file_bucket_file/file_spec.rb +1 -1
  167. data/spec/unit/indirector/node/exec_spec.rb +1 -1
  168. data/spec/unit/indirector/resource/active_record_spec.rb +0 -4
  169. data/spec/unit/interface/action_builder_spec.rb +7 -5
  170. data/spec/unit/module_spec.rb +228 -9
  171. data/spec/unit/module_tool/application_spec.rb +3 -3
  172. data/spec/unit/module_tool/uninstaller_spec.rb +107 -27
  173. data/spec/unit/module_tool_spec.rb +0 -33
  174. data/spec/unit/network/authconfig_spec.rb +22 -21
  175. data/spec/unit/network/http/webrick_spec.rb +13 -9
  176. data/spec/unit/node/environment_spec.rb +159 -66
  177. data/spec/unit/parser/collector_spec.rb +16 -8
  178. data/spec/unit/parser/functions/generate_spec.rb +60 -18
  179. data/spec/unit/parser/resource_spec.rb +44 -0
  180. data/spec/unit/provider/augeas/augeas_spec.rb +160 -179
  181. data/spec/unit/provider/confine/feature_spec.rb +3 -5
  182. data/spec/unit/provider/package/dpkg_spec.rb +4 -2
  183. data/spec/unit/provider/package/gem_spec.rb +59 -43
  184. data/spec/unit/provider/package/openbsd_spec.rb +114 -0
  185. data/spec/unit/provider/package/pacman_spec.rb +1 -1
  186. data/spec/unit/provider/package/pip_spec.rb +10 -4
  187. data/spec/unit/provider/package/zypper_spec.rb +56 -14
  188. data/spec/unit/provider/selmodule_spec.rb +3 -3
  189. data/spec/unit/provider/service/launchd_spec.rb +22 -21
  190. data/spec/unit/provider/service/{upstart.rb → upstart_spec.rb} +7 -3
  191. data/spec/unit/provider/user/pw_spec.rb +19 -0
  192. data/spec/unit/resource/catalog_spec.rb +3 -3
  193. data/spec/unit/semver_spec.rb +117 -24
  194. data/spec/unit/transaction/report_spec.rb +11 -1
  195. data/spec/unit/type/cron_spec.rb +200 -213
  196. data/spec/unit/type/exec_spec.rb +7 -0
  197. data/spec/unit/type/file/content_spec.rb +2 -2
  198. data/spec/unit/type/file_spec.rb +12 -9
  199. data/spec/unit/type/package_spec.rb +25 -0
  200. data/spec/unit/type/schedule_spec.rb +31 -31
  201. data/spec/unit/util/diff_spec.rb +30 -0
  202. data/spec/unit/util/execution_stub_spec.rb +1 -2
  203. data/spec/unit/util/log/destinations_spec.rb +51 -0
  204. data/spec/unit/util/log_spec.rb +17 -1
  205. data/spec/unit/util/monkey_patches_spec.rb +119 -0
  206. data/spec/unit/util/rdoc/parser_spec.rb +25 -1
  207. data/spec/unit/util/selinux_spec.rb +2 -2
  208. data/spec/unit/util/suidmanager_spec.rb +6 -51
  209. data/spec/unit/util_spec.rb +82 -24
  210. data/test/lib/puppettest/certificates.rb +16 -0
  211. data/test/lib/puppettest/servertest.rb +4 -0
  212. data/test/util/pidlock.rb +125 -0
  213. metadata +23 -14
  214. data/ext/puppetstoredconfigclean.rb +0 -103
  215. data/lib/puppet/agent/disabler.rb +0 -27
  216. data/lib/puppet/util/anonymous_filelock.rb +0 -36
  217. data/spec/unit/agent/disabler_spec.rb +0 -60
  218. data/spec/unit/module_tool/repository_spec.rb +0 -52
  219. data/spec/unit/util/anonymous_filelock_spec.rb +0 -78
  220. data/spec/unit/util/pidlock_spec.rb +0 -208
@@ -119,7 +119,7 @@ class Application
119
119
  require 'puppet/util'
120
120
  include Puppet::Util
121
121
 
122
- DOCPATTERN = File.expand_path(File.dirname(__FILE__) + "/util/command_line/*" )
122
+ DOCPATTERN = ::File.expand_path(::File.dirname(__FILE__) + "/util/command_line/*" )
123
123
 
124
124
  class << self
125
125
  include Puppet::Util
@@ -216,7 +216,7 @@ class Application
216
216
  klass = name.to_s.capitalize
217
217
 
218
218
  begin
219
- require File.join('puppet', 'application', name.to_s.downcase)
219
+ require ::File.join('puppet', 'application', name.to_s.downcase)
220
220
  rescue LoadError => e
221
221
  puts "Unable to find application '#{name}'. #{e}"
222
222
  Kernel::exit(1)
@@ -318,7 +318,10 @@ class Application
318
318
  end
319
319
 
320
320
  def setup
321
- # Handle the logging settings
321
+ setup_logs
322
+ end
323
+
324
+ def setup_logs
322
325
  if options[:debug] or options[:verbose]
323
326
  Puppet::Util::Log.newdestination(:console)
324
327
  if options[:debug]
@@ -328,7 +331,7 @@ class Application
328
331
  end
329
332
  end
330
333
 
331
- Puppet::Util::Log.newdestination(:syslog) unless options[:setdest]
334
+ Puppet::Util::Log.setup_default unless options[:setdest]
332
335
  end
333
336
 
334
337
  def configure_indirector_routes
@@ -27,6 +27,7 @@ class Puppet::Application::Agent < Puppet::Application
27
27
  :fqdn => nil,
28
28
  :serve => [],
29
29
  :digest => :MD5,
30
+ :graph => true,
30
31
  :fingerprint => false,
31
32
  }.each do |opt,val|
32
33
  options[opt] = val
@@ -39,12 +40,7 @@ class Puppet::Application::Agent < Puppet::Application
39
40
  end
40
41
 
41
42
  option("--centrallogging")
42
-
43
- option("--disable [MESSAGE]") do |message|
44
- options[:disable] = true
45
- options[:disable_message] = message
46
- end
47
-
43
+ option("--disable")
48
44
  option("--enable")
49
45
  option("--debug","-d")
50
46
  option("--fqdn FQDN","-f")
@@ -106,7 +102,7 @@ similar), or run interactively for testing purposes.
106
102
  USAGE
107
103
  -----
108
104
  puppet agent [--certname <name>] [-D|--daemonize|--no-daemonize]
109
- [-d|--debug] [--detailed-exitcodes] [--digest <digest>] [--disable [message]] [--enable]
105
+ [-d|--debug] [--detailed-exitcodes] [--digest <digest>] [--disable] [--enable]
110
106
  [--fingerprint] [-h|--help] [-l|--logdest syslog|<file>|console]
111
107
  [--no-client] [--noop] [-o|--onetime] [--serve <handler>] [-t|--test]
112
108
  [-v|--verbose] [-V|--version] [-w|--waitforcert <seconds>]
@@ -210,9 +206,6 @@ configuration options can also be generated by running puppet agent with
210
206
  not want the central configuration to override the local state until
211
207
  everything is tested and committed.
212
208
 
213
- Disable can also take an optional message that will be reported by the
214
- 'puppet agent' at the next disabled run.
215
-
216
209
  'puppet agent' uses the same lock file while it is running, so no more
217
210
  than one 'puppet agent' process is working at a time.
218
211
 
@@ -376,25 +369,11 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
376
369
  options[:detailed_exitcodes] = true
377
370
  end
378
371
 
379
- # Handle the logging settings.
380
- def setup_logs
381
- if options[:debug] or options[:verbose]
382
- Puppet::Util::Log.newdestination(:console)
383
- if options[:debug]
384
- Puppet::Util::Log.level = :debug
385
- else
386
- Puppet::Util::Log.level = :info
387
- end
388
- end
389
-
390
- Puppet::Util::Log.newdestination(:syslog) unless options[:setdest]
391
- end
392
-
393
372
  def enable_disable_client(agent)
394
373
  if options[:enable]
395
374
  agent.enable
396
375
  elsif options[:disable]
397
- agent.disable(options[:disable_message] || 'reason not specified')
376
+ agent.disable
398
377
  end
399
378
  exit(0)
400
379
  end
@@ -154,7 +154,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
154
154
  if options[:catalog] == "-"
155
155
  text = $stdin.read
156
156
  else
157
- text = File.read(options[:catalog])
157
+ text = ::File.read(options[:catalog])
158
158
  end
159
159
 
160
160
  begin
@@ -177,7 +177,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
177
177
  Puppet[:code] = options[:code] || STDIN.read
178
178
  else
179
179
  manifest = command_line.args.shift
180
- raise "Could not find file #{manifest}" unless File.exist?(manifest)
180
+ raise "Could not find file #{manifest}" unless ::File.exist?(manifest)
181
181
  Puppet.warning("Only one file can be applied per run. Skipping #{command_line.args.join(', ')}") if command_line.args.size > 0
182
182
  Puppet[:manifest] = manifest
183
183
  end
@@ -208,7 +208,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
208
208
  $stderr.puts "#{file} is not readable"
209
209
  exit(63)
210
210
  end
211
- node.classes = File.read(file).split(/[\s\n]+/)
211
+ node.classes = ::File.read(file).split(/[\s\n]+/)
212
212
  end
213
213
  end
214
214
 
@@ -171,8 +171,8 @@ Licensed under the Apache 2.0 License
171
171
  Puppet.info "starting applying configuration to #{device.name} at #{device.url}"
172
172
 
173
173
  # override local $vardir and $certname
174
- Puppet.settings.set_value(:confdir, File.join(Puppet[:devicedir], device.name), :cli)
175
- Puppet.settings.set_value(:vardir, File.join(Puppet[:devicedir], device.name), :cli)
174
+ Puppet.settings.set_value(:confdir, ::File.join(Puppet[:devicedir], device.name), :cli)
175
+ Puppet.settings.set_value(:vardir, ::File.join(Puppet[:devicedir], device.name), :cli)
176
176
  Puppet.settings.set_value(:certname, device.name, :cli)
177
177
 
178
178
  # this will reload and recompute default settings and create the devices sub vardir, or we hope so :-)
@@ -201,20 +201,6 @@ Licensed under the Apache 2.0 License
201
201
  end
202
202
  end
203
203
 
204
- # Handle the logging settings.
205
- def setup_logs
206
- if options[:debug] or options[:verbose]
207
- Puppet::Util::Log.newdestination(:console)
208
- if options[:debug]
209
- Puppet::Util::Log.level = :debug
210
- else
211
- Puppet::Util::Log.level = :info
212
- end
213
- end
214
-
215
- Puppet::Util::Log.newdestination(:syslog) unless options[:setdest]
216
- end
217
-
218
204
  def setup_host
219
205
  @host = Puppet::SSL::Host.new
220
206
  waitforcert = options[:waitforcert] || (Puppet[:onetime] ? 0 : 120)
@@ -167,7 +167,7 @@ HELP
167
167
  unless @manifest
168
168
  env = Puppet::Node::Environment.new
169
169
  files += env.modulepath
170
- files << File.dirname(env[:manifest])
170
+ files << ::File.dirname(env[:manifest])
171
171
  end
172
172
  files += command_line.args
173
173
  Puppet.info "scanning: #{files.inspect}"
@@ -252,7 +252,7 @@ HELP
252
252
  @unknown_args.each do |option|
253
253
  # force absolute path for modulepath when passed on commandline
254
254
  if option[:opt]=="--modulepath" or option[:opt] == "--manifestdir"
255
- option[:arg] = option[:arg].split(File::PATH_SEPARATOR).collect { |p| File.expand_path(p) }.join(File::PATH_SEPARATOR)
255
+ option[:arg] = option[:arg].split(::File::PATH_SEPARATOR).collect { |p| ::File.expand_path(p) }.join(::File::PATH_SEPARATOR)
256
256
  end
257
257
  Puppet.settings.handlearg(option[:opt], option[:arg])
258
258
  end
@@ -37,10 +37,17 @@ class Puppet::Application::FaceBase < Puppet::Application
37
37
  @render_as or raise ArgumentError, "I don't know how to render '#{format}'"
38
38
  end
39
39
 
40
- def render(result)
41
- # Invoke the rendering hook supplied by the user, if appropriate.
42
- if hook = action.when_rendering(render_as.name)
43
- result = hook.call(result)
40
+ def render(result, args_and_options)
41
+ hook = action.when_rendering(render_as.name)
42
+
43
+ if hook
44
+ # when defining when_rendering on your action you can optionally
45
+ # include arguments and options
46
+ if hook.arity > 1
47
+ result = hook.call(result, *args_and_options)
48
+ else
49
+ result = hook.call(result)
50
+ end
44
51
  end
45
52
 
46
53
  render_as.render(result)
@@ -233,9 +240,19 @@ class Puppet::Application::FaceBase < Puppet::Application
233
240
  end
234
241
 
235
242
  result = @face.send(@action.name, *arguments)
236
- puts render(result) unless result.nil?
243
+ puts render(result, arguments) unless result.nil?
237
244
  status = true
238
245
 
246
+ # We need an easy way for the action to set a specific exit code, so we
247
+ # rescue SystemExit here; This allows each action to set the desired exit
248
+ # code by simply calling Kernel::exit. eg:
249
+ #
250
+ # exit(2)
251
+ #
252
+ # --kelsey 2012-02-14
253
+ rescue SystemExit => detail
254
+ status = detail.status
255
+
239
256
  rescue Exception => detail
240
257
  puts detail.backtrace if Puppet[:trace]
241
258
  Puppet.err detail.to_s
@@ -128,6 +128,8 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
128
128
  end
129
129
 
130
130
  def backup
131
+ raise "You must specify a file to back up" unless args.length > 0
132
+
131
133
  args.each do |file|
132
134
  unless FileTest.exists?(file)
133
135
  $stderr.puts "#{file}: no such file"
@@ -118,6 +118,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
118
118
  end
119
119
 
120
120
  @report.configuration_version = catalog.version
121
+ @report.environment = Puppet[:environment]
121
122
 
122
123
  inspect_starttime = Time.now
123
124
  @report.add_times("config_retrieval", inspect_starttime - retrieval_starttime)
@@ -164,7 +165,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
164
165
  end
165
166
  if Puppet[:archive_files] and ral_resource.type == :file and audited_attributes.include?(:content)
166
167
  path = ral_resource[:path]
167
- if File.readable?(path)
168
+ if ::File.readable?(path)
168
169
  begin
169
170
  dipper.backup(path)
170
171
  rescue StandardError => detail
@@ -76,16 +76,30 @@ copy things like LDAP settings.
76
76
 
77
77
  USAGE NOTES
78
78
  -----------
79
- Puppet kick is useless unless puppet agent is listening for incoming
80
- connections and allowing access to the `run` endpoint. This entails
81
- starting the agent with `listen = true` in its puppet.conf file, and
82
- allowing access to the `/run` path in its auth.conf file; see
83
- `http://docs.puppetlabs.com/guides/rest_auth_conf.html` for more
84
- details.
79
+ Puppet kick needs the puppet agent on the target machine to be running as a
80
+ daemon, be configured to listen for incoming network connections, and have an
81
+ appropriate security configuration.
85
82
 
86
- Additionally, due to a known bug, you must make sure a
87
- namespaceauth.conf file exists in puppet agent's $confdir. This file
88
- will not be consulted, and may be left empty.
83
+ The specific changes required are:
84
+
85
+ * Set `listen = true` in the agent's `puppet.conf` file (or `--listen` on the
86
+ command line)
87
+ * Configure the node's firewall to allow incoming connections on port 8139
88
+ * Insert the following stanza at the top of the node's `auth.conf` file:
89
+
90
+ # Allow puppet kick access
91
+ path /run
92
+ method save
93
+ auth any
94
+ allow workstation.example.com
95
+
96
+ This example would allow the machine `workstation.example.com` to trigger a
97
+ Puppet run; adjust the "allow" directive to suit your site. You may also use
98
+ `allow *` to allow anyone to trigger a Puppet run, but that makes it possible
99
+ to interfere with your site by triggering excessive Puppet runs.
100
+
101
+ See `http://docs.puppetlabs.com/guides/rest_auth_conf.html` for more details
102
+ about security settings.
89
103
 
90
104
  OPTIONS
91
105
  -------
@@ -287,6 +301,8 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
287
301
  end
288
302
 
289
303
  def setup
304
+ raise Puppet::Error.new("Puppet kick is not supported on Microsoft Windows") if Puppet.features.microsoft_windows?
305
+
290
306
  if options[:debug]
291
307
  Puppet::Util::Log.level = :debug
292
308
  else
@@ -118,16 +118,6 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
118
118
  end
119
119
  end
120
120
 
121
- option("--logdest DEST", "-l DEST") do |arg|
122
- begin
123
- Puppet::Util::Log.newdestination(arg)
124
- options[:setdest] = true
125
- rescue => detail
126
- puts detail.backtrace if Puppet[:debug]
127
- $stderr.puts detail.to_s
128
- end
129
- end
130
-
131
121
  def main
132
122
  require 'puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe
133
123
  Puppet.notice "Starting puppetqd #{Puppet.version}"
@@ -148,19 +138,6 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
148
138
  Thread.list.each { |thread| thread.join }
149
139
  end
150
140
 
151
- # Handle the logging settings.
152
- def setup_logs
153
- if options[:debug] or options[:verbose]
154
- Puppet::Util::Log.newdestination(:console)
155
- if options[:debug]
156
- Puppet::Util::Log.level = :debug
157
- else
158
- Puppet::Util::Log.level = :info
159
- end
160
- end
161
- Puppet::Util::Log.newdestination(:syslog) unless options[:setdest]
162
- end
163
-
164
141
  def setup
165
142
  unless Puppet.features.stomp?
166
143
  raise ArgumentError, "Could not load the 'stomp' library, which must be present for queueing to work. You must install the required library."
@@ -116,6 +116,7 @@ class Puppet::Configurer
116
116
 
117
117
  report = options[:report]
118
118
  report.configuration_version = catalog.version
119
+ report.environment = Puppet[:environment]
119
120
 
120
121
  benchmark(:notice, "Finished catalog run") do
121
122
  catalog.apply(options)
@@ -71,12 +71,16 @@ class Puppet::Configurer::Downloader
71
71
  :recurse => true,
72
72
  :source => source,
73
73
  :tag => name,
74
- :owner => Puppet.features.microsoft_windows? ? Sys::Admin.get_login : Process.uid,
75
- :group => Puppet.features.microsoft_windows? ? 'S-1-0-0' : Process.gid,
76
74
  :purge => true,
77
75
  :force => true,
78
76
  :backup => false,
79
77
  :noop => false
80
- }
78
+ }.merge(
79
+ Puppet.features.microsoft_windows? ? {} :
80
+ {
81
+ :owner => Process.uid,
82
+ :group => Process.gid
83
+ }
84
+ )
81
85
  end
82
86
  end
@@ -1,10 +1,10 @@
1
- # The majority of the system configuration parameters are set in this file.
1
+ # The majority of Puppet's configuration settings are set in this file.
2
2
  module Puppet
3
3
  setdefaults(:main,
4
- :confdir => [Puppet.run_mode.conf_dir, "The main Puppet configuration directory. The default for this parameter is calculated based on the user. If the process
4
+ :confdir => [Puppet.run_mode.conf_dir, "The main Puppet configuration directory. The default for this setting is calculated based on the user. If the process
5
5
  is running as root or the user that Puppet is supposed to run as, it defaults to a system directory, but if it's running as any other user,
6
6
  it defaults to being in the user's home directory."],
7
- :vardir => [Puppet.run_mode.var_dir, "Where Puppet stores dynamic and growing data. The default for this parameter is calculated specially, like `confdir`_."],
7
+ :vardir => [Puppet.run_mode.var_dir, "Where Puppet stores dynamic and growing data. The default for this setting is calculated specially, like `confdir`_."],
8
8
  :name => [Puppet.application_name.to_s, "The name of the application, if we are running as one. The
9
9
  default is essentially $0 without the path or `.rb`."],
10
10
  :run_mode => [Puppet.run_mode.name.to_s, "The effective 'run mode' of the application: master, agent, or user."]
@@ -42,18 +42,16 @@ module Puppet
42
42
  sense when used interactively. Takes into account arguments specified
43
43
  on the CLI."],
44
44
  :configprint => ["",
45
- "Print the value of a specific configuration parameter. If a
46
- parameter is provided for this, then the value is printed and puppet
45
+ "Print the value of a specific configuration setting. If the name of a
46
+ setting is provided for this, then the value is printed and puppet
47
47
  exits. Comma-separate multiple values. For a list of all values,
48
- specify 'all'. This feature is only available in Puppet versions
49
- higher than 0.18.4."],
48
+ specify 'all'."],
50
49
  :color => {
51
50
  :default => (Puppet.features.microsoft_windows? ? "false" : "ansi"),
52
51
  :type => :setting,
53
- :desc => "Whether to use colors when logging to the console.
54
- Valid values are `ansi` (equivalent to `true`), `html` (mostly
55
- used during testing with TextMate), and `false`, which produces
56
- no color.",
52
+ :desc => "Whether to use colors when logging to the console. Valid values are
53
+ `ansi` (equivalent to `true`), `html`, and `false`, which produces no color.
54
+ Defaults to false on Windows, as its console does not support ansi colors.",
57
55
  },
58
56
  :mkusers => [false,
59
57
  "Whether to create the necessary user and group that puppet agent will
@@ -94,9 +92,9 @@ module Puppet
94
92
  $LOAD_PATH << value
95
93
  end
96
94
  },
97
- :ignoreimport => [false, "A parameter that can be used in commit
98
- hooks, since it enables you to parse-check a single file rather
99
- than requiring that all files exist."],
95
+ :ignoreimport => [false, "If true, allows the parser to continue without requiring
96
+ all files referenced with `import` statements to exist. This setting was primarily
97
+ designed for use with commit hooks for parse-checking."],
100
98
  :authconfig => [ "$confdir/namespaceauth.conf",
101
99
  "The configuration file that defines the rights to the different
102
100
  namespaces and methods. This can be used as a coarse-grained
@@ -107,15 +105,22 @@ module Puppet
107
105
  is used to find modules and much more. For servers (i.e., `puppet master`) this provides the default environment for nodes
108
106
  we know nothing about."
109
107
  },
110
- :diff_args => ["-u", "Which arguments to pass to the diff command when printing differences between files."],
111
- :diff => ["diff", "Which diff command to use when printing differences between files."],
108
+ :diff_args => ["-u", "Which arguments to pass to the diff command when printing differences between
109
+ files. The command to use can be chosen with the `diff` setting."],
110
+ :diff => {
111
+ :default => (Puppet.features.microsoft_windows? ? "" : "diff"),
112
+ :desc => "Which diff command to use when printing differences between files. This setting
113
+ has no default value on Windows, as standard `diff` is not available, but Puppet can use many
114
+ third-party diff tools.",
115
+ },
112
116
  :show_diff => [false, "Whether to log and report a contextual diff when files are being replaced. This causes
113
117
  partial file contents to pass through Puppet's normal logging and reporting system, so this setting should be
114
118
  used with caution if you are sending Puppet's reports to an insecure destination.
115
119
  This feature currently requires the `diff/lcs` Ruby library."],
116
120
  :daemonize => {
117
121
  :default => (Puppet.features.microsoft_windows? ? false : true),
118
- :desc => "Send the process into the background. This is the default.",
122
+ :desc => "Whether to send the process into the background. This defaults to true on POSIX systems,
123
+ and to false on Windows (where Puppet currently cannot daemonize).",
119
124
  :short => "D",
120
125
  :hook => proc do |value|
121
126
  if value and Puppet.features.microsoft_windows?
@@ -421,17 +426,17 @@ EOT
421
426
  uses that configuration file to determine which keys to sign."},
422
427
  :allow_duplicate_certs => [false, "Whether to allow a new certificate
423
428
  request to overwrite an existing certificate."],
424
- :ca_days => ["", "How long a certificate should be valid.
425
- This parameter is deprecated, use ca_ttl instead"],
429
+ :ca_days => ["", "How long a certificate should be valid, in days.
430
+ This setting is deprecated; use `ca_ttl` instead"],
426
431
  :ca_ttl => ["5y", "The default TTL for new certificates; valid values
427
432
  must be an integer, optionally followed by one of the units
428
433
  'y' (years of 365 days), 'd' (days), 'h' (hours), or
429
- 's' (seconds). The unit defaults to seconds. If this parameter
434
+ 's' (seconds). The unit defaults to seconds. If this setting
430
435
  is set, ca_days is ignored. Examples are '3600' (one hour)
431
436
  and '1825d', which is the same as '5y' (5 years) "],
432
437
  :ca_md => ["md5", "The type of hash used in certificates."],
433
- :req_bits => [2048, "The bit length of the certificates."],
434
- :keylength => [1024, "The bit length of keys."],
438
+ :req_bits => [4096, "The bit length of the certificates."],
439
+ :keylength => [4096, "The bit length of keys."],
435
440
  :cert_inventory => {
436
441
  :default => "$cadir/inventory.txt",
437
442
  :mode => 0644,
@@ -504,7 +509,7 @@ EOT
504
509
  :ca => [true, "Wether the master should function as a certificate authority."],
505
510
  :modulepath => {
506
511
  :default => "$confdir/modules#{File::PATH_SEPARATOR}/usr/share/puppet/modules",
507
- :desc => "The search path for modules as a list of directories separated by the '#{File::PATH_SEPARATOR}' character.",
512
+ :desc => "The search path for modules, as a list of directories separated by the system path separator character. (The POSIX path separator is ':', and the Windows path separator is ';'.)",
508
513
  :type => :setting # We don't want this to be considered a file, since it's multiple files.
509
514
  },
510
515
  :ssl_client_header => ["HTTP_X_CLIENT_DN", "The header containing an authenticated
@@ -755,7 +760,7 @@ EOT
755
760
  :main,
756
761
  :factpath => {:default => "$vardir/lib/facter#{File::PATH_SEPARATOR}$vardir/facts",
757
762
  :desc => "Where Puppet should look for facts. Multiple directories should
758
- be colon-separated, like normal PATH variables.",
763
+ be separated by the system path separator character. (The POSIX path separator is ':', and the Windows path separator is ';'.)",
759
764
 
760
765
  :call_on_define => true, # Call our hook with the default value, so we always get the value added to facter.
761
766
  :type => :setting, # Don't consider it a file, because it could be multiple colon-separated files
@@ -841,10 +846,10 @@ EOT
841
846
  :main,
842
847
  :external_nodes => ["none",
843
848
 
844
- "An external command that can produce node information. The output
845
- must be a YAML dump of a hash, and that hash must have one or both of
846
- `classes` and `parameters`, where `classes` is an array and
847
- `parameters` is a hash. For unknown nodes, the commands should
849
+ "An external command that can produce node information. The command's output
850
+ must be a YAML dump of a hash, and that hash must have a `classes` key and/or
851
+ a `parameters` key, where `classes` is an array or hash and
852
+ `parameters` is a hash. For unknown nodes, the command should
848
853
  exit with a non-zero exit code.
849
854
 
850
855
  This command makes it straightforward to store your node mapping
@@ -936,7 +941,7 @@ database from within the Puppet Master process."
936
941
 
937
942
  :lexical => [false, "Whether to use lexical scoping (vs. dynamic)."],
938
943
  :templatedir => ["$vardir/templates",
939
- "Where Puppet looks for template files. Can be a list of colon-seperated
944
+ "Where Puppet looks for template files. Can be a list of colon-separated
940
945
  directories."
941
946
  ]
942
947
  )