puppet 6.4.4-x86-mingw32 → 6.4.5-x86-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 (221) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +1 -1
  3. data/Gemfile +4 -4
  4. data/Gemfile.lock +38 -32
  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 +38 -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/application/ssl.rb +4 -1
  18. data/lib/puppet/configurer.rb +86 -30
  19. data/lib/puppet/configurer/downloader.rb +2 -6
  20. data/lib/puppet/defaults.rb +32 -6
  21. data/lib/puppet/error.rb +9 -1
  22. data/lib/puppet/face/module/list.rb +5 -5
  23. data/lib/puppet/face/module/search.rb +1 -1
  24. data/lib/puppet/face/module/uninstall.rb +1 -1
  25. data/lib/puppet/face/module/upgrade.rb +1 -1
  26. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  27. data/lib/puppet/file_system.rb +0 -8
  28. data/lib/puppet/file_system/memory_file.rb +1 -1
  29. data/lib/puppet/file_system/posix.rb +3 -2
  30. data/lib/puppet/forge.rb +3 -3
  31. data/lib/puppet/functions.rb +1 -2
  32. data/lib/puppet/functions/camelcase.rb +2 -2
  33. data/lib/puppet/functions/epp.rb +4 -4
  34. data/lib/puppet/functions/find_file.rb +9 -9
  35. data/lib/puppet/functions/inline_epp.rb +5 -5
  36. data/lib/puppet/gettext/module_translations.rb +1 -1
  37. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  38. data/lib/puppet/graph/simple_graph.rb +4 -3
  39. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  40. data/lib/puppet/indirector/hiera.rb +2 -0
  41. data/lib/puppet/indirector/resource/ral.rb +1 -3
  42. data/lib/puppet/indirector/resource/validator.rb +1 -1
  43. data/lib/puppet/interface.rb +2 -1
  44. data/lib/puppet/loaders.rb +0 -1
  45. data/lib/puppet/metatype/manager.rb +1 -1
  46. data/lib/puppet/module.rb +1 -1
  47. data/lib/puppet/module/task.rb +20 -4
  48. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  49. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  50. data/lib/puppet/module_tool/metadata.rb +1 -1
  51. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  52. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  53. data/lib/puppet/network/http/api/indirected_routes.rb +12 -11
  54. data/lib/puppet/network/http/connection.rb +10 -12
  55. data/lib/puppet/network/http/pool.rb +2 -0
  56. data/lib/puppet/network/http/site.rb +1 -1
  57. data/lib/puppet/network/resolver.rb +2 -2
  58. data/lib/puppet/node/environment.rb +4 -2
  59. data/lib/puppet/pal/pal_impl.rb +2 -2
  60. data/lib/puppet/parser/ast.rb +1 -1
  61. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  62. data/lib/puppet/parser/functions.rb +1 -1
  63. data/lib/puppet/parser/functions/epp.rb +3 -3
  64. data/lib/puppet/parser/functions/inline_epp.rb +5 -5
  65. data/lib/puppet/parser/scope.rb +8 -7
  66. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  67. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  68. data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
  69. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  70. data/lib/puppet/pops/loader/task_instantiator.rb +4 -0
  71. data/lib/puppet/pops/loaders.rb +1 -1
  72. data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
  73. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  74. data/lib/puppet/pops/merge_strategy.rb +22 -18
  75. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  76. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  77. data/lib/puppet/pops/parser/locator.rb +1 -1
  78. data/lib/puppet/pops/parser/pn_parser.rb +17 -16
  79. data/lib/puppet/pops/puppet_stack.rb +51 -49
  80. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  81. data/lib/puppet/pops/types/string_converter.rb +10 -10
  82. data/lib/puppet/pops/types/types.rb +3 -3
  83. data/lib/puppet/property.rb +1 -1
  84. data/lib/puppet/property/ensure.rb +1 -1
  85. data/lib/puppet/provider/exec.rb +6 -2
  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/apt.rb +5 -1
  89. data/lib/puppet/provider/package/dnfmodule.rb +87 -0
  90. data/lib/puppet/provider/package/dpkg.rb +34 -18
  91. data/lib/puppet/provider/package/openbsd.rb +1 -1
  92. data/lib/puppet/provider/package/pip.rb +34 -9
  93. data/lib/puppet/provider/package/portage.rb +4 -4
  94. data/lib/puppet/provider/package/rpm.rb +5 -5
  95. data/lib/puppet/provider/package/windows/package.rb +1 -1
  96. data/lib/puppet/provider/package/yum.rb +1 -1
  97. data/lib/puppet/provider/package_targetable.rb +5 -4
  98. data/lib/puppet/provider/parsedfile.rb +1 -1
  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 +9 -9
  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/reference/indirection.rb +2 -2
  110. data/lib/puppet/reference/metaparameter.rb +1 -3
  111. data/lib/puppet/reference/providers.rb +1 -3
  112. data/lib/puppet/reference/type.rb +3 -9
  113. data/lib/puppet/reports.rb +1 -1
  114. data/lib/puppet/resource.rb +1 -1
  115. data/lib/puppet/resource/catalog.rb +1 -1
  116. data/lib/puppet/settings.rb +3 -3
  117. data/lib/puppet/settings/environment_conf.rb +1 -0
  118. data/lib/puppet/ssl/host.rb +1 -1
  119. data/lib/puppet/ssl/oids.rb +1 -1
  120. data/lib/puppet/transaction.rb +33 -11
  121. data/lib/puppet/transaction/report.rb +1 -1
  122. data/lib/puppet/type.rb +2 -4
  123. data/lib/puppet/type/exec.rb +7 -3
  124. data/lib/puppet/type/file.rb +1 -2
  125. data/lib/puppet/type/file/data_sync.rb +5 -1
  126. data/lib/puppet/type/group.rb +4 -2
  127. data/lib/puppet/type/notify.rb +3 -2
  128. data/lib/puppet/type/package.rb +10 -3
  129. data/lib/puppet/type/schedule.rb +1 -1
  130. data/lib/puppet/type/service.rb +1 -1
  131. data/lib/puppet/type/user.rb +4 -2
  132. data/lib/puppet/util.rb +35 -12
  133. data/lib/puppet/util/command_line/trollop.rb +1 -1
  134. data/lib/puppet/util/http_proxy.rb +8 -14
  135. data/lib/puppet/util/log.rb +2 -2
  136. data/lib/puppet/util/log/destinations.rb +2 -2
  137. data/lib/puppet/util/logging.rb +32 -20
  138. data/lib/puppet/util/metric.rb +2 -2
  139. data/lib/puppet/util/provider_features.rb +2 -4
  140. data/lib/puppet/util/rdoc.rb +1 -1
  141. data/lib/puppet/util/reference.rb +1 -1
  142. data/lib/puppet/util/resource_template.rb +1 -1
  143. data/lib/puppet/util/selinux.rb +3 -1
  144. data/lib/puppet/util/windows/adsi.rb +48 -18
  145. data/lib/puppet/util/windows/registry.rb +7 -5
  146. data/lib/puppet/vendor.rb +1 -1
  147. data/lib/puppet/version.rb +1 -1
  148. data/lib/puppet/x509/cert_provider.rb +13 -6
  149. data/locales/puppet.pot +199 -159
  150. data/man/man5/puppet.conf.5 +35 -5
  151. data/man/man8/puppet-agent.8 +1 -1
  152. data/man/man8/puppet-apply.8 +1 -1
  153. data/man/man8/puppet-catalog.8 +1 -1
  154. data/man/man8/puppet-config.8 +1 -1
  155. data/man/man8/puppet-describe.8 +1 -1
  156. data/man/man8/puppet-device.8 +1 -1
  157. data/man/man8/puppet-doc.8 +1 -1
  158. data/man/man8/puppet-epp.8 +1 -1
  159. data/man/man8/puppet-facts.8 +1 -1
  160. data/man/man8/puppet-filebucket.8 +1 -1
  161. data/man/man8/puppet-generate.8 +1 -1
  162. data/man/man8/puppet-help.8 +1 -1
  163. data/man/man8/puppet-key.8 +1 -1
  164. data/man/man8/puppet-lookup.8 +1 -1
  165. data/man/man8/puppet-man.8 +1 -1
  166. data/man/man8/puppet-module.8 +1 -1
  167. data/man/man8/puppet-node.8 +1 -1
  168. data/man/man8/puppet-parser.8 +1 -1
  169. data/man/man8/puppet-plugin.8 +1 -1
  170. data/man/man8/puppet-report.8 +1 -1
  171. data/man/man8/puppet-resource.8 +1 -1
  172. data/man/man8/puppet-script.8 +1 -1
  173. data/man/man8/puppet-ssl.8 +1 -1
  174. data/man/man8/puppet-status.8 +1 -1
  175. data/man/man8/puppet.8 +2 -2
  176. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +11 -0
  177. data/spec/integration/configurer_spec.rb +52 -0
  178. data/spec/integration/type/notify_spec.rb +46 -0
  179. data/spec/lib/puppet/certificate_factory.rb +2 -2
  180. data/spec/spec_helper.rb +28 -0
  181. data/spec/unit/application/ssl_spec.rb +4 -7
  182. data/spec/unit/configurer_spec.rb +394 -398
  183. data/spec/unit/defaults_spec.rb +4 -4
  184. data/spec/unit/forge/forge_spec.rb +1 -3
  185. data/spec/unit/forge/repository_spec.rb +1 -3
  186. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  187. data/spec/unit/network/http/connection_spec.rb +119 -145
  188. data/spec/unit/parser/scope_spec.rb +10 -0
  189. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
  190. data/spec/unit/pops/loaders/module_loaders_spec.rb +37 -0
  191. data/spec/unit/provider/exec_spec.rb +209 -0
  192. data/spec/unit/provider/package/dnfmodule_spec.rb +186 -0
  193. data/spec/unit/provider/package/dpkg_spec.rb +238 -78
  194. data/spec/unit/provider/package/pip_spec.rb +51 -6
  195. data/spec/unit/provider/package/portage_spec.rb +4 -4
  196. data/spec/unit/provider/package_targetable_spec.rb +60 -0
  197. data/spec/unit/provider/service/daemontools_spec.rb +24 -0
  198. data/spec/unit/provider/service/runit_spec.rb +24 -0
  199. data/spec/unit/provider/service/systemd_spec.rb +25 -25
  200. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  201. data/spec/unit/provider/user/useradd_spec.rb +46 -0
  202. data/spec/unit/ssl/host_spec.rb +0 -5
  203. data/spec/unit/ssl/state_machine_spec.rb +0 -6
  204. data/spec/unit/transaction_spec.rb +46 -0
  205. data/spec/unit/type/exec_spec.rb +6 -12
  206. data/spec/unit/type/file/content_spec.rb +9 -3
  207. data/spec/unit/type/file_spec.rb +9 -4
  208. data/spec/unit/type/package_spec.rb +5 -0
  209. data/spec/unit/util/execution_spec.rb +16 -0
  210. data/spec/unit/util/http_proxy_spec.rb +118 -27
  211. data/spec/unit/util/log/destinations_spec.rb +7 -3
  212. data/spec/unit/util/log_spec.rb +0 -138
  213. data/spec/unit/util/logging_spec.rb +200 -0
  214. data/spec/unit/util/windows/adsi_spec.rb +51 -0
  215. data/spec/unit/x509/cert_provider_spec.rb +24 -4
  216. data/tasks/manpages.rake +1 -0
  217. metadata +12 -10
  218. data/lib/puppet/pops/loader/null_loader.rb +0 -60
  219. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +0 -24
  220. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +0 -24
  221. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +0 -24
@@ -125,14 +125,13 @@ Puppet::Type.type(:user).provide :windows_adsi do
125
125
 
126
126
  def password=(value)
127
127
  if user.disabled?
128
- warning _("The user account '%s' is disabled; puppet will not reset the password" % @resource[:name])
128
+ info _("The user account '%s' is disabled; The password will still be changed" % @resource[:name])
129
129
  elsif user.locked_out?
130
- warning _("The user account '%s' is locked out; puppet will not reset the password" % @resource[:name])
130
+ info _("The user account '%s' is locked out; The password will still be changed" % @resource[:name])
131
131
  elsif user.expired?
132
- warning _("The user account '%s' is expired; puppet will not reset the password" % @resource[:name])
133
- else
134
- user.password = value
132
+ info _("The user account '%s' is expired; The password will still be changed" % @resource[:name])
135
133
  end
134
+ user.password = value
136
135
  end
137
136
 
138
137
  def uid
@@ -5,14 +5,14 @@ require 'puppet/file_serving/metadata'
5
5
 
6
6
  reference = Puppet::Util::Reference.newreference :indirection, :doc => "Indirection types and their terminus classes" do
7
7
  text = ""
8
- Puppet::Indirector::Indirection.instances.sort { |a,b| a.to_s <=> b.to_s }.each do |indirection|
8
+ Puppet::Indirector::Indirection.instances.sort_by(&:to_s).each do |indirection|
9
9
  ind = Puppet::Indirector::Indirection.instance(indirection)
10
10
  name = indirection.to_s.capitalize
11
11
  text << "## " + indirection.to_s + "\n\n"
12
12
 
13
13
  text << Puppet::Util::Docs.scrub(ind.doc) + "\n\n"
14
14
 
15
- Puppet::Indirector::Terminus.terminus_classes(ind.name).sort { |a,b| a.to_s <=> b.to_s }.each do |terminus|
15
+ Puppet::Indirector::Terminus.terminus_classes(ind.name).sort_by(&:to_s).each do |terminus|
16
16
  terminus_name = terminus.to_s
17
17
  term_class = Puppet::Indirector::Terminus.terminus_class(ind.name, terminus)
18
18
  if term_class
@@ -19,9 +19,7 @@ etc.), prevent Puppet from making changes (`noop`), and change logging verbosity
19
19
  params << param
20
20
  }
21
21
 
22
- params.sort { |a,b|
23
- a.to_s <=> b.to_s
24
- }.each { |param|
22
+ params.sort_by(&:to_s).each { |param|
25
23
  str << markdown_header(param.to_s, 3)
26
24
  str << scrub(Puppet::Type.metaparamdoc(param))
27
25
  str << "\n\n"
@@ -32,10 +32,9 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
32
32
 
33
33
  table_data = {}
34
34
 
35
- functional = false
36
35
  notes = []
37
36
  default = type.defaultprovider ? type.defaultprovider.name : 'none'
38
- type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname|
37
+ type.providers.sort_by(&:to_s).each do |pname|
39
38
  data = []
40
39
  table_data[pname] = data
41
40
  provider = type.provider(pname)
@@ -44,7 +43,6 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
44
43
  if missing = provider.suitable?(false) and missing.empty?
45
44
  data << "*X*"
46
45
  suit = true
47
- functional = true
48
46
  else
49
47
  data << "[#{count}]_" # A pointer to the appropriate footnote
50
48
  suit = false
@@ -49,9 +49,7 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
49
49
 
50
50
  }
51
51
 
52
- types.sort { |a,b|
53
- a.to_s <=> b.to_s
54
- }.each { |name,type|
52
+ types.sort_by(&:to_s).each { |name,type|
55
53
 
56
54
  str << "
57
55
 
@@ -69,9 +67,7 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
69
67
  end
70
68
 
71
69
  docs = {}
72
- type.validproperties.sort { |a,b|
73
- a.to_s <=> b.to_s
74
- }.reject { |sname|
70
+ type.validproperties.sort_by(&:to_s).reject { |sname|
75
71
  property = type.propertybyname(sname)
76
72
  property.nodoc
77
73
  }.each { |sname|
@@ -91,9 +87,7 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
91
87
  }
92
88
 
93
89
  str << markdown_header("Parameters", 4) + "\n"
94
- type.parameters.sort { |a,b|
95
- a.to_s <=> b.to_s
96
- }.each { |type_name, param|
90
+ type.parameters.sort_by(&:to_s).each { |type_name, param|
97
91
  docs[type_name] = scrub(type.paramdoc(type_name))
98
92
  }
99
93
 
@@ -74,7 +74,7 @@ class Puppet::Reports
74
74
 
75
75
  # Use this method so they all get loaded
76
76
  instance_loader(:report).loadall(Puppet.lookup(:current_environment))
77
- loaded_instances(:report).sort { |a,b| a.to_s <=> b.to_s }.each do |name|
77
+ loaded_instances(:report).sort_by(&:to_s).each do |name|
78
78
  mod = self.report(name)
79
79
  docs << "#{name}\n#{"-" * name.to_s.length}\n"
80
80
 
@@ -209,7 +209,7 @@ class Puppet::Resource
209
209
  end
210
210
 
211
211
  def stage?
212
- @is_stage ||= @type.to_s.downcase == "stage"
212
+ @is_stage ||= @type.to_s.casecmp("stage").zero?
213
213
  end
214
214
 
215
215
  # Construct a resource from data.
@@ -637,7 +637,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
637
637
  result.add_resource newres
638
638
  end
639
639
 
640
- message = convert.to_s.gsub "_", " "
640
+ message = convert.to_s.tr "_", " "
641
641
  edges.each do |edge|
642
642
  # Skip edges between virtual resources.
643
643
  next if virtual_not_exported?(edge.source)
@@ -1229,10 +1229,10 @@ Generated on #{Time.now}.
1229
1229
  if !Puppet::FileSystem.symlink?(configured_environment_path)
1230
1230
  parameters = { :ensure => 'directory' }
1231
1231
  unless Puppet::FileSystem.exist?(configured_environment_path)
1232
- parameters.merge!(:mode => '0750')
1232
+ parameters[:mode] = '0750'
1233
1233
  if Puppet.features.root?
1234
- parameters.merge!(:owner => Puppet[:user]) if service_user_available?
1235
- parameters.merge!(:group => Puppet[:group]) if service_group_available?
1234
+ parameters[:owner] = Puppet[:user] if service_user_available?
1235
+ parameters[:group] = Puppet[:group] if service_group_available?
1236
1236
  end
1237
1237
  end
1238
1238
  catalog.add_resource(Puppet::Resource.new(:file, configured_environment_path, :parameters => parameters))
@@ -159,6 +159,7 @@ class Puppet::Settings::EnvironmentConf
159
159
 
160
160
  return valid
161
161
  end
162
+ private_class_method :validate
162
163
 
163
164
  def get_setting(setting_name, default = nil)
164
165
  value = raw_setting(setting_name)
@@ -272,7 +272,7 @@ ERROR_STRING
272
272
  exit(1)
273
273
  end
274
274
 
275
- while true
275
+ loop do
276
276
  sleep time
277
277
  begin
278
278
  break if certificate
@@ -101,7 +101,7 @@ module Puppet::SSL::Oids
101
101
  # shortname: 'myothershortname'
102
102
  # longname: 'Other Long name'
103
103
  def self.parse_custom_oid_file(custom_oid_file, map_key='oid_mapping')
104
- if File.exists?(custom_oid_file) && File.readable?(custom_oid_file)
104
+ if File.exist?(custom_oid_file) && File.readable?(custom_oid_file)
105
105
  mapping = nil
106
106
  begin
107
107
  mapping = Puppet::Util::Yaml.safe_load_file(custom_oid_file, [Symbol])
@@ -57,7 +57,11 @@ class Puppet::Transaction
57
57
 
58
58
  @prefetch_failed_providers = Hash.new { |h,k| h[k] = {} }
59
59
 
60
+ # With merge_dependency_warnings, notify and warn about class dependency failures ... just once per class. TJK 2019-09-09
61
+ @merge_dependency_warnings = Puppet[:merge_dependency_warnings]
60
62
  @failed_dependencies_already_notified = Set.new()
63
+ @failed_class_dependencies_already_notified = Set.new()
64
+ @failed_class_dependencies_already_warned = Set.new()
61
65
  end
62
66
 
63
67
  # Invoke the pre_run_check hook in every resource in the catalog.
@@ -287,15 +291,25 @@ class Puppet::Transaction
287
291
  # explosion of edges, we also ended up reporting failures for containers
288
292
  # like class and stage. This is undesirable; while just skipping the
289
293
  # output isn't perfect, it is RC-safe. --daniel 2011-06-07
290
- suppress_report = (resource.class == Puppet::Type.type(:whit))
291
-
294
+ is_puppet_class = resource.class == Puppet::Type.type(:whit)
295
+ # With merge_dependency_warnings, notify about class dependency failures ... just once per class. TJK 2019-09-09
292
296
  s = resource_status(resource)
293
297
  if s && s.dependency_failed?
294
- # See above. --daniel 2011-06-06
295
- unless suppress_report then
296
- s.failed_dependencies.find_all { |d| !(@failed_dependencies_already_notified.include?(d.ref)) }.each do |dep|
297
- resource.notice _("Dependency %{dep} has failures: %{status}") % { dep: dep, status: resource_status(dep).failed }
298
- @failed_dependencies_already_notified.add(dep.ref)
298
+ if @merge_dependency_warnings && is_puppet_class
299
+ # Notes: Puppet::Resource::Status.failed_dependencies() is an Array of Puppet::Resource(s) and
300
+ # Puppet::Resource.ref() calls Puppet::Resource.to_s() which is: "#{type}[#{title}]" and
301
+ # Puppet::Resource.resource_status(resource) calls Puppet::Resource.to_s()
302
+ class_dependencies_to_be_notified = (s.failed_dependencies.map(&:ref) - @failed_class_dependencies_already_notified.to_a)
303
+ class_dependencies_to_be_notified.each do |dep_ref|
304
+ resource.notice _("Class dependency %{dep} has failures: %{status}") % { dep: dep_ref, status: resource_status(dep_ref).failed }
305
+ end
306
+ @failed_class_dependencies_already_notified.merge(class_dependencies_to_be_notified)
307
+ else
308
+ unless @merge_dependency_warnings || is_puppet_class
309
+ s.failed_dependencies.find_all { |d| !(@failed_dependencies_already_notified.include?(d.ref)) }.each do |dep|
310
+ resource.notice _("Dependency %{dep} has failures: %{status}") % { dep: dep, status: resource_status(dep).failed }
311
+ @failed_dependencies_already_notified.add(dep.ref)
312
+ end
299
313
  end
300
314
  end
301
315
  end
@@ -395,11 +409,19 @@ class Puppet::Transaction
395
409
  # explosion of edges, we also ended up reporting failures for containers
396
410
  # like class and stage. This is undesirable; while just skipping the
397
411
  # output isn't perfect, it is RC-safe. --daniel 2011-06-07
398
- unless resource.class == Puppet::Type.type(:whit) then
399
- resource.warning _("Skipping because of failed dependencies")
412
+ # With merge_dependency_warnings, warn about class dependency failures ... just once per class. TJK 2019-09-09
413
+ unless resource.class == Puppet::Type.type(:whit)
414
+ if @merge_dependency_warnings && resource.parent && failed_dependencies?(resource.parent)
415
+ ps = resource_status(resource.parent)
416
+ ps.failed_dependencies.find_all { |d| !(@failed_class_dependencies_already_warned.include?(d.ref)) }.each do |dep|
417
+ resource.parent.warning _("Skipping resources in class because of failed class dependencies")
418
+ @failed_class_dependencies_already_warned.add(dep.ref)
419
+ end
420
+ else
421
+ resource.warning _("Skipping because of failed dependencies")
422
+ end
400
423
  end
401
- elsif resource_status(resource).failed? &&
402
- @prefetch_failed_providers[resource.type][resource.provider.class.name]
424
+ elsif resource_status(resource).failed? && @prefetch_failed_providers[resource.type][resource.provider.class.name]
403
425
  #Do not try to evaluate a resource with a known failed provider
404
426
  resource.warning _("Skipping because provider prefetch failed")
405
427
  elsif resource.virtual?
@@ -346,7 +346,7 @@ class Puppet::Transaction::Report
346
346
  report = raw_summary
347
347
 
348
348
  ret = ""
349
- report.keys.sort { |a,b| a.to_s <=> b.to_s }.each do |key|
349
+ report.keys.sort_by(&:to_s).each do |key|
350
350
  ret += "#{Puppet::Util::Metric.labelize(key)}:\n"
351
351
 
352
352
  report[key].keys.sort { |a,b|
@@ -1454,7 +1454,7 @@ class Type
1454
1454
  }
1455
1455
 
1456
1456
  Tags are useful for things like applying a subset of a host's configuration
1457
- with [the `tags` setting](/puppet/latest/configuration.html#tags)
1457
+ with [the `tags` setting](https://puppet.com/docs/puppet/latest/configuration.html#tags)
1458
1458
  (e.g. `puppet agent --test --tags bootstrap`)."
1459
1459
 
1460
1460
  munge do |tags|
@@ -1916,9 +1916,7 @@ end
1916
1916
  # Since we're mixing @doc with text from other sources, we must normalize
1917
1917
  # its indentation with scrub. But we don't need to manually scrub the
1918
1918
  # provider's doc string, since markdown_definitionlist sanitizes its inputs.
1919
- scrub(@doc) + "Available providers are:\n\n" + parenttype.providers.sort { |a,b|
1920
- a.to_s <=> b.to_s
1921
- }.collect { |i|
1919
+ scrub(@doc) + "Available providers are:\n\n" + parenttype.providers.sort_by(&:to_s).collect { |i|
1922
1920
  markdown_definitionlist( i, scrub(parenttype().provider(i).doc) )
1923
1921
  }.join
1924
1922
  end
@@ -150,9 +150,13 @@ module Puppet
150
150
  end
151
151
  end
152
152
  unless log == :false
153
- @output.split(/\n/).each { |line|
154
- self.send(log, line)
155
- }
153
+ if @resource.parameter(:command).sensitive
154
+ self.send(log, "[output redacted]")
155
+ else
156
+ @output.split(/\n/).each { |line|
157
+ self.send(log, line)
158
+ }
159
+ end
156
160
  end
157
161
  end
158
162
 
@@ -577,8 +577,7 @@ Puppet::Type.newtype(:file) do
577
577
  # remote system.
578
578
  mark_children_for_purging(children) if self.purge?
579
579
 
580
- # REVISIT: sort_by is more efficient?
581
- result = children.values.sort { |a, b| a[:path] <=> b[:path] }
580
+ result = children.values.sort_by { |a| a[:path] }
582
581
  remove_less_specific_files(result)
583
582
  end
584
583
 
@@ -42,7 +42,11 @@ module Puppet
42
42
  send resource[:loglevel], "[diff redacted]"
43
43
  else
44
44
  write_temporarily(param) do |path|
45
- send resource[:loglevel], "\n" + diff(resource[:path], path)
45
+ diff_output = diff(resource[:path], path)
46
+ if diff_output.encoding == Encoding::BINARY || !diff_output.valid_encoding?
47
+ diff_output = "Binary files #{resource[:path]} and #{path} differ"
48
+ end
49
+ send resource[:loglevel], "\n" + diff_output
46
50
  end
47
51
  end
48
52
  end
@@ -175,7 +175,8 @@ module Puppet
175
175
  end
176
176
 
177
177
  newparam(:ia_load_module, :required_features => :manages_aix_lam) do
178
- desc "The name of the I&A module to use to manage this user"
178
+ desc "The name of the I&A module to use to manage this group.
179
+ This should be set to `files` if managing local groups."
179
180
  end
180
181
 
181
182
  newproperty(:attributes, :parent => Puppet::Property::KeyValue, :required_features => :manages_aix_lam) do
@@ -216,7 +217,8 @@ module Puppet
216
217
  :required_features => :libuser,
217
218
  :parent => Puppet::Parameter::Boolean) do
218
219
  desc "Forces the management of local accounts when accounts are also
219
- being managed by some other NSS"
220
+ being managed by some other NSS. For AIX, refer to the
221
+ `ia_load_module` parameter."
220
222
  defaultto false
221
223
  end
222
224
 
@@ -11,11 +11,12 @@ module Puppet
11
11
  newproperty(:message, :idempotent => false) do
12
12
  desc "The message to be sent to the log."
13
13
  def sync
14
+ message = @sensitive ? 'Sensitive [value redacted]' : self.should
14
15
  case @resource["withpath"]
15
16
  when :true
16
- send(@resource[:loglevel], self.should)
17
+ send(@resource[:loglevel], message)
17
18
  else
18
- Puppet.send(@resource[:loglevel], self.should)
19
+ Puppet.send(@resource[:loglevel], message)
19
20
  end
20
21
  return
21
22
  end
@@ -485,8 +485,8 @@ module Puppet
485
485
  end
486
486
 
487
487
  newparam(:flavor) do
488
- desc "OpenBSD supports 'flavors', which are further specifications for
489
- which type of package you want."
488
+ desc "OpenBSD and DNF modules support 'flavors', which are
489
+ further specifications for which type of package you want."
490
490
  end
491
491
 
492
492
  newparam(:install_only, :boolean => false, :parent => Puppet::Parameter::Boolean, :required_features => :install_only) do
@@ -548,7 +548,14 @@ module Puppet
548
548
  newparam(:allow_virtual, :boolean => true, :parent => Puppet::Parameter::Boolean, :required_features => :virtual_packages) do
549
549
  desc 'Specifies if virtual package names are allowed for install and uninstall.'
550
550
 
551
- defaultto true
551
+ defaultto do
552
+ provider_class = provider.class
553
+ if provider_class.respond_to?(:defaultto_allow_virtual)
554
+ provider_class.defaultto_allow_virtual
555
+ else
556
+ true
557
+ end
558
+ end
552
559
  end
553
560
 
554
561
  autorequire(:file) do
@@ -338,7 +338,7 @@ module Puppet
338
338
  end
339
339
 
340
340
  def weekday_integer?(value)
341
- value.is_a?(Integer) && (0..6).include?(value)
341
+ value.is_a?(Integer) && (0..6).cover?(value)
342
342
  end
343
343
 
344
344
  def weekday_string?(value)
@@ -230,7 +230,7 @@ module Puppet
230
230
  desc "The control variable used to manage services (originally for HP-UX).
231
231
  Defaults to the upcased service name plus `START` replacing dots with
232
232
  underscores, for those providers that support the `controllable` feature."
233
- defaultto { resource.name.gsub(".","_").upcase + "_START" if resource.provider.controllable? }
233
+ defaultto { resource.name.tr(".","_").upcase + "_START" if resource.provider.controllable? }
234
234
  end
235
235
 
236
236
  newparam :hasrestart do
@@ -614,7 +614,8 @@ module Puppet
614
614
  end
615
615
 
616
616
  newparam(:ia_load_module, :required_features => :manages_aix_lam) do
617
- desc "The name of the I&A module to use to manage this user."
617
+ desc "The name of the I&A module to use to manage this user.
618
+ This should be set to `files` if managing local users."
618
619
  end
619
620
 
620
621
  newproperty(:attributes, :parent => Puppet::Property::KeyValue, :required_features => :manages_aix_lam) do
@@ -678,7 +679,8 @@ module Puppet
678
679
  :required_features => :libuser,
679
680
  :parent => Puppet::Parameter::Boolean) do
680
681
  desc "Forces the management of local accounts when accounts are also
681
- being managed by some other NSS"
682
+ being managed by some other NSS. For AIX, refer to the
683
+ `ia_load_module` parameter."
682
684
  defaultto false
683
685
  end
684
686
 
@@ -322,7 +322,7 @@ module Util
322
322
  params = { :scheme => 'file' }
323
323
 
324
324
  if Puppet::Util::Platform.windows?
325
- path = path.gsub(/\\/, '/')
325
+ path = path.tr('\\', '/')
326
326
 
327
327
  if unc = /^\/\/([^\/]+)(\/.+)/.match(path)
328
328
  params[:host] = unc[1]
@@ -523,21 +523,44 @@ module Util
523
523
 
524
524
  module_function :thinmark
525
525
 
526
+ PUPPET_STACK_INSERTION_FRAME = /.*puppet_stack\.rb.*in.*`stack'/
527
+
526
528
  # utility method to get the current call stack and format it to a human-readable string (which some IDEs/editors
527
529
  # will recognize as links to the line numbers in the trace)
528
- def self.pretty_backtrace(backtrace = caller(1))
529
- backtrace.collect do |line|
530
- _, path, rest = /^(.*):(\d+.*)$/.match(line).to_a
531
- # If the path doesn't exist - like in one test, and like could happen in
532
- # the world - we should just tolerate it and carry on. --daniel 2012-09-05
533
- # Also, if we don't match, just include the whole line.
534
- if path
535
- path = Pathname(path).realpath rescue path
536
- "#{path}:#{rest}"
530
+ def self.pretty_backtrace(backtrace = caller(1), puppetstack = [])
531
+ format_backtrace_array(backtrace, puppetstack).join("\n")
532
+ end
533
+
534
+ # arguments may be a Ruby stack, with an optional Puppet stack argument,
535
+ # or just a Puppet stack.
536
+ # stacks may be an Array of Strings "/foo.rb:0 in `blah'" or
537
+ # an Array of Arrays that represent a frame: ["/foo.pp", 0]
538
+ def self.format_backtrace_array(primary_stack, puppetstack = [])
539
+ primary_stack.flat_map do |frame|
540
+ frame = format_puppetstack_frame(frame) if frame.is_a?(Array)
541
+ primary_frame = resolve_stackframe(frame)
542
+
543
+ if primary_frame =~ PUPPET_STACK_INSERTION_FRAME && !puppetstack.empty?
544
+ [resolve_stackframe(format_puppetstack_frame(puppetstack.shift)),
545
+ primary_frame]
537
546
  else
538
- line
547
+ primary_frame
539
548
  end
540
- end.join("\n")
549
+ end
550
+ end
551
+
552
+ def self.resolve_stackframe(frame)
553
+ _, path, rest = /^(.*):(\d+.*)$/.match(frame).to_a
554
+ if path
555
+ path = Pathname(path).realpath rescue path
556
+ "#{path}:#{rest}"
557
+ else
558
+ frame
559
+ end
560
+ end
561
+
562
+ def self.format_puppetstack_frame(file_and_lineno)
563
+ file_and_lineno.join(':')
541
564
  end
542
565
 
543
566
  # Replace a file, securely. This takes a block, and passes it the file