puppet 5.5.17-x64-mingw32 → 5.5.18-x64-mingw32

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 (225) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +1 -1
  3. data/Gemfile +2 -3
  4. data/Gemfile.lock +35 -31
  5. data/ext/build_defaults.yaml +1 -0
  6. data/ext/cert_inspector +3 -3
  7. data/ext/puppet-test +2 -2
  8. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  9. data/ext/windows/service/daemon.rb +54 -8
  10. data/install.rb +6 -6
  11. data/lib/puppet/application.rb +1 -1
  12. data/lib/puppet/application/apply.rb +2 -2
  13. data/lib/puppet/application/describe.rb +3 -9
  14. data/lib/puppet/application/doc.rb +1 -1
  15. data/lib/puppet/application/lookup.rb +1 -1
  16. data/lib/puppet/application/script.rb +2 -2
  17. data/lib/puppet/configurer.rb +86 -28
  18. data/lib/puppet/configurer/downloader.rb +2 -6
  19. data/lib/puppet/defaults.rb +17 -4
  20. data/lib/puppet/error.rb +9 -1
  21. data/lib/puppet/external/nagios/base.rb +1 -1
  22. data/lib/puppet/face/ca.rb +1 -1
  23. data/lib/puppet/face/module/list.rb +5 -5
  24. data/lib/puppet/face/module/search.rb +1 -1
  25. data/lib/puppet/face/module/uninstall.rb +1 -1
  26. data/lib/puppet/face/module/upgrade.rb +1 -1
  27. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  28. data/lib/puppet/file_system.rb +0 -8
  29. data/lib/puppet/file_system/memory_file.rb +1 -1
  30. data/lib/puppet/file_system/posix.rb +3 -2
  31. data/lib/puppet/forge.rb +3 -3
  32. data/lib/puppet/functions/epp.rb +4 -4
  33. data/lib/puppet/functions/inline_epp.rb +5 -5
  34. data/lib/puppet/gettext/module_translations.rb +1 -1
  35. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  36. data/lib/puppet/graph/simple_graph.rb +6 -5
  37. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  38. data/lib/puppet/indirector/hiera.rb +2 -0
  39. data/lib/puppet/indirector/resource/ral.rb +1 -3
  40. data/lib/puppet/indirector/resource/validator.rb +1 -1
  41. data/lib/puppet/interface.rb +2 -1
  42. data/lib/puppet/loaders.rb +0 -1
  43. data/lib/puppet/metatype/manager.rb +1 -1
  44. data/lib/puppet/module.rb +1 -1
  45. data/lib/puppet/module_tool/applications/builder.rb +1 -1
  46. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  47. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  48. data/lib/puppet/module_tool/metadata.rb +1 -1
  49. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  50. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  51. data/lib/puppet/network/http/api/indirected_routes.rb +12 -11
  52. data/lib/puppet/network/http/connection.rb +10 -12
  53. data/lib/puppet/network/http/pool.rb +2 -0
  54. data/lib/puppet/network/http/rack/rest.rb +2 -2
  55. data/lib/puppet/network/http/site.rb +1 -1
  56. data/lib/puppet/network/resolver.rb +2 -2
  57. data/lib/puppet/node/environment.rb +4 -2
  58. data/lib/puppet/parser/ast.rb +1 -1
  59. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  60. data/lib/puppet/parser/functions.rb +1 -1
  61. data/lib/puppet/parser/functions/epp.rb +3 -3
  62. data/lib/puppet/parser/functions/inline_epp.rb +5 -5
  63. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  64. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  65. data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
  66. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  67. data/lib/puppet/pops/loaders.rb +1 -1
  68. data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
  69. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  70. data/lib/puppet/pops/merge_strategy.rb +22 -18
  71. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  72. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  73. data/lib/puppet/pops/parser/locator.rb +1 -1
  74. data/lib/puppet/pops/parser/pn_parser.rb +17 -16
  75. data/lib/puppet/pops/puppet_stack.rb +51 -48
  76. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  77. data/lib/puppet/pops/types/string_converter.rb +10 -10
  78. data/lib/puppet/pops/types/types.rb +3 -3
  79. data/lib/puppet/property.rb +1 -1
  80. data/lib/puppet/property/ensure.rb +1 -1
  81. data/lib/puppet/provider/augeas/augeas.rb +1 -1
  82. data/lib/puppet/provider/cron/crontab.rb +1 -1
  83. data/lib/puppet/provider/exec.rb +6 -2
  84. data/lib/puppet/provider/mount.rb +1 -1
  85. data/lib/puppet/provider/mount/parsed.rb +8 -8
  86. data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
  87. data/lib/puppet/provider/nameservice/pw.rb +2 -2
  88. data/lib/puppet/provider/package/dnfmodule.rb +87 -0
  89. data/lib/puppet/provider/package/dpkg.rb +3 -12
  90. data/lib/puppet/provider/package/openbsd.rb +1 -1
  91. data/lib/puppet/provider/package/pip.rb +34 -9
  92. data/lib/puppet/provider/package/portage.rb +4 -4
  93. data/lib/puppet/provider/package/rpm.rb +6 -6
  94. data/lib/puppet/provider/package/windows/package.rb +1 -1
  95. data/lib/puppet/provider/package/yum.rb +1 -1
  96. data/lib/puppet/provider/package_targetable.rb +5 -4
  97. data/lib/puppet/provider/parsedfile.rb +1 -1
  98. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +3 -3
  99. data/lib/puppet/provider/service/daemontools.rb +9 -9
  100. data/lib/puppet/provider/service/openbsd.rb +1 -1
  101. data/lib/puppet/provider/service/rcng.rb +2 -2
  102. data/lib/puppet/provider/service/runit.rb +2 -8
  103. data/lib/puppet/provider/service/systemd.rb +8 -8
  104. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  105. data/lib/puppet/provider/user/hpux.rb +1 -1
  106. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  107. data/lib/puppet/provider/user/useradd.rb +22 -13
  108. data/lib/puppet/provider/user/windows_adsi.rb +4 -5
  109. data/lib/puppet/provider/yumrepo/inifile.rb +2 -2
  110. data/lib/puppet/reference/indirection.rb +2 -2
  111. data/lib/puppet/reference/metaparameter.rb +1 -3
  112. data/lib/puppet/reference/providers.rb +1 -1
  113. data/lib/puppet/reference/type.rb +3 -9
  114. data/lib/puppet/reports.rb +1 -1
  115. data/lib/puppet/resource.rb +1 -1
  116. data/lib/puppet/resource/catalog.rb +1 -1
  117. data/lib/puppet/settings.rb +3 -3
  118. data/lib/puppet/settings/environment_conf.rb +1 -0
  119. data/lib/puppet/ssl/certificate_authority/interface.rb +1 -1
  120. data/lib/puppet/ssl/certificate_factory.rb +2 -2
  121. data/lib/puppet/ssl/host.rb +3 -3
  122. data/lib/puppet/ssl/oids.rb +1 -1
  123. data/lib/puppet/transaction/report.rb +1 -1
  124. data/lib/puppet/type.rb +2 -4
  125. data/lib/puppet/type/cron.rb +1 -1
  126. data/lib/puppet/type/exec.rb +7 -3
  127. data/lib/puppet/type/file.rb +1 -2
  128. data/lib/puppet/type/file/data_sync.rb +5 -1
  129. data/lib/puppet/type/group.rb +4 -2
  130. data/lib/puppet/type/interface.rb +1 -1
  131. data/lib/puppet/type/notify.rb +3 -2
  132. data/lib/puppet/type/package.rb +2 -2
  133. data/lib/puppet/type/schedule.rb +1 -1
  134. data/lib/puppet/type/selboolean.rb +17 -3
  135. data/lib/puppet/type/service.rb +1 -1
  136. data/lib/puppet/type/user.rb +4 -2
  137. data/lib/puppet/util.rb +35 -12
  138. data/lib/puppet/util/command_line/trollop.rb +1 -1
  139. data/lib/puppet/util/http_proxy.rb +8 -14
  140. data/lib/puppet/util/instance_loader.rb +1 -1
  141. data/lib/puppet/util/log.rb +1 -1
  142. data/lib/puppet/util/log/destinations.rb +2 -2
  143. data/lib/puppet/util/logging.rb +30 -18
  144. data/lib/puppet/util/metric.rb +2 -2
  145. data/lib/puppet/util/monkey_patches.rb +1 -1
  146. data/lib/puppet/util/nagios_maker.rb +2 -2
  147. data/lib/puppet/util/network_device/cisco/device.rb +1 -1
  148. data/lib/puppet/util/network_device/cisco/interface.rb +2 -2
  149. data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
  150. data/lib/puppet/util/provider_features.rb +2 -4
  151. data/lib/puppet/util/rdoc.rb +1 -1
  152. data/lib/puppet/util/reference.rb +1 -1
  153. data/lib/puppet/util/resource_template.rb +1 -1
  154. data/lib/puppet/util/selinux.rb +3 -1
  155. data/lib/puppet/util/windows/adsi.rb +58 -28
  156. data/lib/puppet/util/windows/registry.rb +7 -5
  157. data/lib/puppet/vendor.rb +1 -1
  158. data/lib/puppet/version.rb +1 -1
  159. data/lib/puppet_pal.rb +2 -2
  160. data/locales/puppet.pot +115 -95
  161. data/man/man5/puppet.conf.5 +21 -5
  162. data/man/man8/puppet-agent.8 +1 -1
  163. data/man/man8/puppet-apply.8 +1 -1
  164. data/man/man8/puppet-ca.8 +1 -1
  165. data/man/man8/puppet-catalog.8 +1 -1
  166. data/man/man8/puppet-cert.8 +1 -1
  167. data/man/man8/puppet-certificate.8 +1 -1
  168. data/man/man8/puppet-certificate_request.8 +1 -1
  169. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  170. data/man/man8/puppet-config.8 +1 -1
  171. data/man/man8/puppet-describe.8 +1 -1
  172. data/man/man8/puppet-device.8 +1 -1
  173. data/man/man8/puppet-doc.8 +1 -1
  174. data/man/man8/puppet-epp.8 +1 -1
  175. data/man/man8/puppet-facts.8 +1 -1
  176. data/man/man8/puppet-filebucket.8 +1 -1
  177. data/man/man8/puppet-generate.8 +1 -1
  178. data/man/man8/puppet-help.8 +1 -1
  179. data/man/man8/puppet-key.8 +1 -1
  180. data/man/man8/puppet-lookup.8 +1 -1
  181. data/man/man8/puppet-man.8 +1 -1
  182. data/man/man8/puppet-master.8 +1 -1
  183. data/man/man8/puppet-module.8 +1 -1
  184. data/man/man8/puppet-node.8 +1 -1
  185. data/man/man8/puppet-parser.8 +1 -1
  186. data/man/man8/puppet-plugin.8 +1 -1
  187. data/man/man8/puppet-report.8 +1 -1
  188. data/man/man8/puppet-resource.8 +1 -1
  189. data/man/man8/puppet-script.8 +1 -1
  190. data/man/man8/puppet-status.8 +1 -1
  191. data/man/man8/puppet.8 +2 -2
  192. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +11 -0
  193. data/spec/integration/configurer_spec.rb +52 -0
  194. data/spec/integration/type/notify_spec.rb +46 -0
  195. data/spec/unit/configurer_spec.rb +380 -397
  196. data/spec/unit/forge/forge_spec.rb +1 -3
  197. data/spec/unit/forge/repository_spec.rb +1 -3
  198. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  199. data/spec/unit/network/http/connection_spec.rb +26 -0
  200. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
  201. data/spec/unit/provider/exec_spec.rb +209 -0
  202. data/spec/unit/provider/package/dnfmodule_spec.rb +186 -0
  203. data/spec/unit/provider/package/dpkg_spec.rb +15 -3
  204. data/spec/unit/provider/package/pip_spec.rb +51 -6
  205. data/spec/unit/provider/package/portage_spec.rb +4 -4
  206. data/spec/unit/provider/package_targetable_spec.rb +60 -0
  207. data/spec/unit/provider/service/daemontools_spec.rb +24 -0
  208. data/spec/unit/provider/service/runit_spec.rb +24 -0
  209. data/spec/unit/provider/service/systemd_spec.rb +22 -22
  210. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  211. data/spec/unit/provider/user/useradd_spec.rb +46 -0
  212. data/spec/unit/type/exec_spec.rb +6 -12
  213. data/spec/unit/type/file/content_spec.rb +9 -3
  214. data/spec/unit/type/file_spec.rb +9 -4
  215. data/spec/unit/type/selboolean_spec.rb +4 -6
  216. data/spec/unit/util/execution_spec.rb +16 -0
  217. data/spec/unit/util/http_proxy_spec.rb +97 -0
  218. data/spec/unit/util/log/destinations_spec.rb +7 -3
  219. data/spec/unit/util/log_spec.rb +0 -138
  220. data/spec/unit/util/logging_spec.rb +200 -0
  221. data/spec/unit/util/windows/adsi_spec.rb +51 -0
  222. data/tasks/manpages.rake +1 -0
  223. metadata +12 -5
  224. data/lib/puppet/pops/loader/null_loader.rb +0 -60
  225. data/locales/ja/puppet.po +0 -12114
@@ -154,7 +154,7 @@ HELP
154
154
  with_contents = options[:references].length <= 1
155
155
  exit_code = 0
156
156
  require 'puppet/util/reference'
157
- options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name|
157
+ options[:references].sort_by(&:to_s).each do |name|
158
158
  raise _("Could not find reference %{name}") % { name: name } unless section = Puppet::Util::Reference.reference(name)
159
159
 
160
160
  begin
@@ -283,7 +283,7 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
283
283
  'merge_hash_arrays' => !options[:merge_hash_arrays].nil?}
284
284
 
285
285
  if options[:prefix]
286
- merge_options.merge!({'knockout_prefix' => options[:prefix]})
286
+ merge_options['knockout_prefix'] = options[:prefix]
287
287
  end
288
288
 
289
289
  else
@@ -209,8 +209,8 @@ Copyright (c) 2017 Puppet Inc., LLC Licensed under the Apache 2.0 License
209
209
 
210
210
  compiler.compile()
211
211
 
212
- rescue Puppet::ParseErrorWithIssue, Puppet::Error
213
- # already logged and handled by the compiler for these two cases
212
+ rescue Puppet::Error
213
+ # already logged and handled by the compiler, including Puppet::ParseErrorWithIssue
214
214
  exit(1)
215
215
  end
216
216
 
@@ -144,9 +144,10 @@ class Puppet::Configurer
144
144
  facts_hash
145
145
  end
146
146
 
147
- def prepare_and_retrieve_catalog(options, query_options)
147
+ def prepare_and_retrieve_catalog(cached_catalog, options, query_options)
148
148
  # set report host name now that we have the fact
149
149
  options[:report].host = Puppet[:node_name_value]
150
+
150
151
  query_options[:transaction_uuid] = @transaction_uuid
151
152
  query_options[:job_id] = @job_id
152
153
  query_options[:static_catalog] = @static_catalog
@@ -156,24 +157,19 @@ class Puppet::Configurer
156
157
  query_options[:checksum_type] = @checksum_type.join('.')
157
158
 
158
159
  # apply passes in ral catalog
159
- catalog = options.delete(:catalog)
160
- return catalog if catalog
161
-
162
- # retrieve_catalog returns json catalog
163
- catalog = retrieve_catalog(query_options)
164
- return convert_catalog(catalog, @duration, options) if catalog
165
-
166
- Puppet.err _("Could not retrieve catalog; skipping run")
167
- nil
160
+ catalog = cached_catalog || options[:catalog]
161
+ unless catalog
162
+ # retrieve_catalog returns resource catalog
163
+ catalog = retrieve_catalog(query_options)
164
+ Puppet.err _("Could not retrieve catalog; skipping run") unless catalog
165
+ end
166
+ catalog
168
167
  end
169
168
 
170
169
  def prepare_and_retrieve_catalog_from_cache(options = {})
171
170
  result = retrieve_catalog_from_cache({:transaction_uuid => @transaction_uuid, :static_catalog => @static_catalog})
172
- if result
173
- Puppet.info _("Using cached catalog from environment '%{catalog_env}'") % { catalog_env: result.environment }
174
- return convert_catalog(result, @duration, options)
175
- end
176
- nil
171
+ Puppet.info _("Using cached catalog from environment '%{catalog_env}'") % { catalog_env: result.environment } if result
172
+ result
177
173
  end
178
174
 
179
175
  # Apply supplied catalog and return associated application report
@@ -251,13 +247,12 @@ class Puppet::Configurer
251
247
  Puppet::GettextConfig.reset_text_domain('agent')
252
248
  Puppet::ModuleTranslations.load_from_vardir(Puppet[:vardir])
253
249
 
254
- if catalog = prepare_and_retrieve_catalog_from_cache(options)
255
- options[:catalog] = catalog
250
+ if cached_catalog = prepare_and_retrieve_catalog_from_cache(options)
256
251
  @cached_catalog_status = 'explicitly_requested'
257
252
 
258
- if @environment != catalog.environment && !Puppet[:strict_environment_mode]
259
- Puppet.notice _("Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'.") % { local_env: @environment, catalog_env: catalog.environment }
260
- @environment = catalog.environment
253
+ if @environment != cached_catalog.environment && !Puppet[:strict_environment_mode]
254
+ Puppet.notice _("Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'.") % { local_env: @environment, catalog_env: cached_catalog.environment }
255
+ @environment = cached_catalog.environment
261
256
  end
262
257
 
263
258
  report.environment = @environment
@@ -278,7 +273,7 @@ class Puppet::Configurer
278
273
  configured_environment = Puppet[:environment] if Puppet.settings.set_by_config?(:environment)
279
274
 
280
275
  # We only need to find out the environment to run in if we don't already have a catalog
281
- unless (options[:catalog] || Puppet[:strict_environment_mode])
276
+ unless (cached_catalog || options[:catalog] || Puppet[:strict_environment_mode])
282
277
  begin
283
278
  node = nil
284
279
  node_retr_time = thinmark do
@@ -329,7 +324,7 @@ class Puppet::Configurer
329
324
  query_options = get_facts(options) unless query_options
330
325
  query_options[:configured_environment] = configured_environment
331
326
 
332
- unless catalog = prepare_and_retrieve_catalog(options, query_options)
327
+ unless catalog = prepare_and_retrieve_catalog(cached_catalog, options, query_options)
333
328
  return nil
334
329
  end
335
330
 
@@ -354,16 +349,37 @@ class Puppet::Configurer
354
349
  query_options = get_facts(options)
355
350
  query_options[:configured_environment] = configured_environment
356
351
 
357
- return nil unless catalog = prepare_and_retrieve_catalog(options, query_options)
352
+ # if we get here, ignore the cached catalog
353
+ return nil unless catalog = prepare_and_retrieve_catalog(nil, options, query_options)
358
354
  tries += 1
359
355
  end
360
356
 
357
+ # now that environment has converged, convert resource catalog into ral catalog
358
+ # unless we were given a RAL catalog
359
+ if !cached_catalog && options[:catalog]
360
+ ral_catalog = options[:catalog]
361
+ else
362
+ # REMIND @duration is the time spent loading the last catalog, and doesn't
363
+ # account for things like we failed to download and fell back to the cache
364
+ ral_catalog = convert_catalog(catalog, @duration, options)
365
+
366
+ # If not noop, commit the cached resource catalog (not ral catalog). Ideally
367
+ # we'd just copy the downloaded response body, instead of serializing the
368
+ # in-memory catalog, but that's hard due to the indirector.
369
+ indirection = Puppet::Resource::Catalog.indirection
370
+ if !Puppet[:noop] && indirection.cache?
371
+ request = indirection.request(:save, nil, catalog, environment: Puppet::Node::Environment.remote(catalog.environment))
372
+ Puppet.info("Caching catalog for #{request.key}")
373
+ indirection.cache.save(request)
374
+ end
375
+ end
376
+
361
377
  execute_prerun_command or return nil
362
378
 
363
- options[:report].code_id = catalog.code_id
364
- options[:report].catalog_uuid = catalog.catalog_uuid
379
+ options[:report].code_id = ral_catalog.code_id
380
+ options[:report].catalog_uuid = ral_catalog.catalog_uuid
365
381
  options[:report].cached_catalog_status = @cached_catalog_status
366
- apply_catalog(catalog, options)
382
+ apply_catalog(ral_catalog, options)
367
383
  true
368
384
  rescue => detail
369
385
  Puppet.log_exception(detail, _("Failed to apply catalog: %{detail}") % { detail: detail })
@@ -372,6 +388,14 @@ class Puppet::Configurer
372
388
  execute_postrun_command or return nil
373
389
  end
374
390
  ensure
391
+ if Puppet[:resubmit_facts]
392
+ # TODO: Should mark the report as "failed" if an error occurs and
393
+ # resubmit_facts returns false. There is currently no API for this.
394
+ resubmit_facts_time = thinmark { resubmit_facts }
395
+
396
+ report.add_times(:resubmit_facts, resubmit_facts_time)
397
+ end
398
+
375
399
  report.cached_catalog_status ||= @cached_catalog_status
376
400
  report.add_times(:total, Time.now - start)
377
401
  report.finalize_report
@@ -418,6 +442,40 @@ class Puppet::Configurer
418
442
  Puppet.log_exception(detail, _("Could not save last run local report: %{detail}") % { detail: detail })
419
443
  end
420
444
 
445
+ # Submit updated facts to the Puppet Server
446
+ #
447
+ # This method will clear all current fact values, load a fresh set of
448
+ # fact data, and then submit it to the Puppet Server.
449
+ #
450
+ # @return [true] If fact submission succeeds.
451
+ # @return [false] If an exception is raised during fact generation or
452
+ # submission.
453
+ def resubmit_facts
454
+ ::Facter.clear
455
+ facts = find_facts
456
+
457
+ saved_fact_terminus = Puppet::Node::Facts.indirection.terminus_class
458
+ begin
459
+ Puppet::Node::Facts.indirection.terminus_class = :rest
460
+
461
+ server = Puppet::Node::Facts::Rest.server
462
+ Puppet.info(_("Uploading facts for %{node} to %{server}") % {
463
+ node: facts.name,
464
+ server: server})
465
+
466
+ Puppet::Node::Facts.indirection.save(facts, nil, :environment => Puppet::Node::Environment.remote(@environment))
467
+
468
+ return true
469
+ ensure
470
+ Puppet::Node::Facts.indirection.terminus_class = saved_fact_terminus
471
+ end
472
+ rescue => detail
473
+ Puppet.log_exception(detail, _("Failed to submit facts: %{detail}") %
474
+ { detail: detail })
475
+
476
+ return false
477
+ end
478
+
421
479
  private
422
480
 
423
481
  def execute_from_setting(setting)
@@ -456,8 +514,8 @@ class Puppet::Configurer
456
514
  Puppet[:node_name_value],
457
515
  query_options.merge(
458
516
  :ignore_cache => true,
459
- # We never want to update the cached Catalog if we're running in noop mode.
460
- :ignore_cache_save => Puppet[:noop],
517
+ # don't update cache until after environment converges
518
+ :ignore_cache_save => true,
461
519
  :environment => Puppet::Node::Environment.remote(@environment),
462
520
  :fail_on_404 => true
463
521
  )
@@ -55,12 +55,8 @@ class Puppet::Configurer::Downloader
55
55
  :noop => false
56
56
  }
57
57
  if !Puppet.features.microsoft_windows?
58
- defargs.merge!(
59
- {
60
- :owner => Process.uid,
61
- :group => Process.gid
62
- }
63
- )
58
+ defargs[:owner] = Process.uid
59
+ defargs[:group] = Process.gid
64
60
  end
65
61
  return defargs
66
62
  end
@@ -180,12 +180,19 @@ module Puppet
180
180
  :trace => {
181
181
  :default => false,
182
182
  :type => :boolean,
183
- :desc => "Whether to print stack traces on some errors",
183
+ :desc => "Whether to print stack traces on some errors. Will print
184
+ internal Ruby stack trace interleaved with Puppet function frames.",
184
185
  :hook => proc do |value|
185
186
  # Enable or disable Facter's trace option too
186
187
  Facter.trace(value) if Facter.respond_to? :trace
187
188
  end
188
189
  },
190
+ :puppet_trace => {
191
+ :default => false,
192
+ :type => :boolean,
193
+ :desc => "Whether to print the Puppet stack trace on some errors.
194
+ This is a noop if `trace` is also set.",
195
+ },
189
196
  :profile => {
190
197
  :default => false,
191
198
  :type => :boolean,
@@ -524,9 +531,10 @@ module Puppet
524
531
  },
525
532
  :http_proxy_host => {
526
533
  :default => "none",
527
- :desc => "The HTTP proxy host to use for outgoing connections. Note: You
534
+ :desc => "The HTTP proxy host to use for outgoing connections. The proxy will be bypassed if
535
+ the server's hostname matches the NO_PROXY environment variable or `no_proxy` setting. Note: You
528
536
  may need to use a FQDN for the server hostname when using a proxy. Environment variable
529
- http_proxy or HTTP_PROXY will override this value",
537
+ http_proxy or HTTP_PROXY will override this value. ",
530
538
  },
531
539
  :http_proxy_port => {
532
540
  :default => 3128,
@@ -552,7 +560,7 @@ module Puppet
552
560
  },
553
561
  :no_proxy => {
554
562
  :default => "localhost, 127.0.0.1",
555
- :desc => "List of domain names that should not go through `http_proxy_host`. Environment variable no_proxy or NO_PROXY will override this value.",
563
+ :desc => "List of host or domain names that should not go through `http_proxy_host`. Environment variable no_proxy or NO_PROXY will override this value. Names can be specified as an FQDN `host.example.com`, wildcard `*.example.com`, dotted domain `.example.com`, or suffix `example.com`.",
556
564
  },
557
565
  :http_keepalive_timeout => {
558
566
  :default => "4s",
@@ -1730,6 +1738,11 @@ EOT
1730
1738
  :type => :boolean,
1731
1739
  :desc => "Whether to send reports after every transaction.",
1732
1740
  },
1741
+ :resubmit_facts => {
1742
+ :default => false,
1743
+ :type => :boolean,
1744
+ :desc => "Whether to send updated facts after every transaction.",
1745
+ },
1733
1746
  :lastrunfile => {
1734
1747
  :default => "$statedir/last_run_summary.yaml",
1735
1748
  :type => :file,
data/lib/puppet/error.rb CHANGED
@@ -12,7 +12,7 @@ module Puppet
12
12
  # This module implements logging with a filename and line number. Use this
13
13
  # for errors that need to report a location in a non-ruby file that we
14
14
  # parse.
15
- attr_accessor :line, :file, :pos
15
+ attr_accessor :line, :file, :pos, :puppetstack
16
16
 
17
17
  # May be called with 3 arguments for message, file, line, and exception, or
18
18
  # 4 args including the position on the line.
@@ -22,10 +22,18 @@ module Puppet
22
22
  original = pos
23
23
  pos = nil
24
24
  end
25
+
25
26
  super(message, original)
27
+
26
28
  @file = file unless (file.is_a?(String) && file.empty?)
27
29
  @line = line
28
30
  @pos = pos
31
+
32
+ if original && original.respond_to?(:puppetstack)
33
+ @puppetstack = original.puppetstack
34
+ else
35
+ @puppetstack = Puppet::Pops::PuppetStack.stacktrace()
36
+ end
29
37
  end
30
38
 
31
39
  def to_s
@@ -250,7 +250,7 @@ class Nagios::Base
250
250
  if map.include?(param)
251
251
  return map[param]
252
252
  else
253
- return "nagios-" + param.id2name.gsub(/_/,'-')
253
+ return "nagios-" + param.id2name.tr('_','-')
254
254
  end
255
255
  end
256
256
 
@@ -93,7 +93,7 @@ Puppet::Face.define(:ca, '0.1.0') do
93
93
  ca.verify(host.name)
94
94
  "+ #{name} #{host.certificate.digest(options[:digest])}"
95
95
  rescue Puppet::SSL::CertificateAuthority::CertificateVerificationError => e
96
- "- #{name} #{host.certificate.digest(options[:digest])} (#{e.to_s})"
96
+ "- #{name} #{host.certificate.digest(options[:digest])} (#{e})"
97
97
  end
98
98
  end
99
99
  end.join("\n")
@@ -128,10 +128,10 @@ Puppet::Face.define(:module, '1.0.0') do
128
128
  unmet_grouped.each do |type, deps|
129
129
  unless deps.empty?
130
130
  unmet_grouped[type].sort_by { |dep| dep[:name] }.each do |dep|
131
- dep_name = dep[:name].gsub('/', '-')
131
+ dep_name = dep[:name].tr('/', '-')
132
132
  installed_version = dep[:mod_details][:installed_version]
133
133
  version_constraint = dep[:version_constraint]
134
- parent_name = dep[:parent][:name].gsub('/', '-')
134
+ parent_name = dep[:parent][:name].tr('/', '-')
135
135
  parent_version = dep[:parent][:version]
136
136
 
137
137
  msg = _("'%{parent_name}' (%{parent_version}) requires '%{dependency_name}' (%{dependency_version})") % { parent_name: parent_name, parent_version: parent_version, dependency_name: dep_name, dependency_version: version_constraint }
@@ -151,7 +151,7 @@ Puppet::Face.define(:module, '1.0.0') do
151
151
  error_display_order.each do |type|
152
152
  unless @unmet_deps[type].empty?
153
153
  @unmet_deps[type].keys.sort.each do |dep|
154
- name = dep.gsub('/', '-')
154
+ name = dep.tr('/', '-')
155
155
  errors = @unmet_deps[type][dep][:errors]
156
156
  version = @unmet_deps[type][dep][:version]
157
157
 
@@ -219,7 +219,7 @@ Puppet::Face.define(:module, '1.0.0') do
219
219
  dep[:reason] == :missing
220
220
  end
221
221
  missing_deps.map do |mis_mod|
222
- str = "#{colorize(:bg_red, _('UNMET DEPENDENCY'))} #{mis_mod[:name].gsub('/', '-')} "
222
+ str = "#{colorize(:bg_red, _('UNMET DEPENDENCY'))} #{mis_mod[:name].tr('/', '-')} "
223
223
  str << "(#{colorize(:cyan, mis_mod[:version_constraint])})"
224
224
  node[:dependencies] << { :text => str }
225
225
  end
@@ -244,7 +244,7 @@ Puppet::Face.define(:module, '1.0.0') do
244
244
  #
245
245
  def list_build_node(mod, parent, params)
246
246
  str = ''
247
- str << (mod.forge_name ? mod.forge_name.gsub('/', '-') : mod.name)
247
+ str << (mod.forge_name ? mod.forge_name.tr('/', '-') : mod.name)
248
248
  str << ' (' + colorize(:cyan, mod.version ? "v#{mod.version}" : '???') + ')'
249
249
 
250
250
  unless File.dirname(mod.path) == params[:path]
@@ -81,7 +81,7 @@ Puppet::Face.define(:module, '1.0.0') do
81
81
 
82
82
  highlight = proc do |s|
83
83
  s = s.gsub(term, colorize(:green, term))
84
- s = s.gsub(term.gsub('/', '-'), colorize(:green, term.gsub('/', '-'))) if term =~ /\//
84
+ s = s.gsub(term.tr('/', '-'), colorize(:green, term.tr('/', '-'))) if term =~ /\//
85
85
  s = s.gsub(' DEPRECATED', colorize(:red, ' DEPRECATED'))
86
86
  s
87
87
  end
@@ -61,7 +61,7 @@ Puppet::Face.define(:module, '1.0.0') do
61
61
  end
62
62
 
63
63
  when_invoked do |name, options|
64
- name = name.gsub('/', '-')
64
+ name = name.tr('/', '-')
65
65
 
66
66
  Puppet::ModuleTool.set_option_defaults options
67
67
  message = if options[:version]
@@ -67,7 +67,7 @@ Puppet::Face.define(:module, '1.0.0') do
67
67
  end
68
68
 
69
69
  when_invoked do |name, options|
70
- name = name.gsub('/', '-')
70
+ name = name.tr('/', '-')
71
71
  Puppet.notice _("Preparing to upgrade '%{name}' ...") % { name: name }
72
72
  Puppet::ModuleTool.set_option_defaults options
73
73
  Puppet::ModuleTool::Applications::Upgrader.new(name, options).run
@@ -40,7 +40,7 @@ class Puppet::FileServing::HttpMetadata < Puppet::FileServing::Metadata
40
40
  [ @checksum_type, :md5, :sha256, :sha384, :sha512, :sha224, :mtime ].each do |type|
41
41
  @checksum_type = type
42
42
  @checksum = @checksums[type]
43
- return if @checksum
43
+ break if @checksum
44
44
  end
45
45
  end
46
46
  end
@@ -89,14 +89,6 @@ module Puppet::FileSystem
89
89
  @impl.path_string(@impl.basename(assert_path(path)))
90
90
  end
91
91
 
92
- # @return [Integer] the size of the file
93
- #
94
- # @api public
95
- #
96
- def self.size(path)
97
- @impl.size(assert_path(path))
98
- end
99
-
100
92
  # Allows exclusive updates to a file to be made by excluding concurrent
101
93
  # access using flock. This means that if the file is on a filesystem that
102
94
  # does not support flock, this method will provide no protection.
@@ -61,6 +61,6 @@ class Puppet::FileSystem::MemoryFile
61
61
  end
62
62
 
63
63
  def inspect
64
- "<Puppet::FileSystem::MemoryFile:#{to_s}>"
64
+ "<Puppet::FileSystem::MemoryFile:#{self}>"
65
65
  end
66
66
  end
@@ -14,11 +14,12 @@ class Puppet::FileSystem::Posix < Puppet::FileSystem::FileImpl
14
14
  bsize = stream_blksize(this, stream)
15
15
  sa = "".force_encoding('ASCII-8BIT')
16
16
  sb = "".force_encoding('ASCII-8BIT')
17
- begin
17
+ loop do
18
18
  this.read(bsize, sa)
19
19
  stream.read(bsize, sb)
20
20
  return true if sa.empty? && sb.empty?
21
- end while sa == sb
21
+ break if sa != sb
22
+ end
22
23
  false
23
24
  end
24
25
  end