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
@@ -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"
@@ -35,7 +35,7 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
35
35
  functional = false
36
36
  notes = []
37
37
  default = type.defaultprovider ? type.defaultprovider.name : 'none'
38
- type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname|
38
+ type.providers.sort_by(&:to_s).each do |pname|
39
39
  data = []
40
40
  table_data[pname] = data
41
41
  provider = type.provider(pname)
@@ -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
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
 
@@ -192,7 +192,7 @@ class Puppet::Resource
192
192
  end
193
193
 
194
194
  def stage?
195
- @is_stage ||= @type.to_s.downcase == "stage"
195
+ @is_stage ||= @type.to_s.casecmp("stage").zero?
196
196
  end
197
197
 
198
198
  # Construct a resource from data.
@@ -647,7 +647,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
647
647
  result.add_resource newres
648
648
  end
649
649
 
650
- message = convert.to_s.gsub "_", " "
650
+ message = convert.to_s.tr "_", " "
651
651
  edges.each do |edge|
652
652
  # Skip edges between virtual resources.
653
653
  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)
@@ -79,7 +79,7 @@ module Puppet
79
79
  begin
80
80
  ca.verify(host) unless requests.include?(host)
81
81
  rescue Puppet::SSL::CertificateAuthority::CertificateVerificationError => details
82
- verify_error = "(#{details.to_s})"
82
+ verify_error = "(#{details})"
83
83
  end
84
84
 
85
85
  if verify_error
@@ -26,9 +26,9 @@ module Puppet::SSL::CertificateFactory
26
26
  # @return [OpenSSL::X509::Certificate]
27
27
  def self.build(cert_type, csr, issuer, serial, ttl = nil)
28
28
  # Work out if we can even build the requested type of certificate.
29
- build_extensions = "build_#{cert_type.to_s}_extensions"
29
+ build_extensions = "build_#{cert_type}_extensions"
30
30
  respond_to?(build_extensions) or
31
- raise ArgumentError, _("%{cert_type} is an invalid certificate type!") % { cert_type: cert_type.to_s }
31
+ raise ArgumentError, _("%{cert_type} is an invalid certificate type!") % { cert_type: cert_type }
32
32
 
33
33
  raise ArgumentError, _("Certificate TTL must be an integer") unless ttl.nil? || ttl.is_a?(Integer)
34
34
 
@@ -210,7 +210,7 @@ DOC
210
210
  raise Puppet::Error, _("No certificate to validate.") unless certificate
211
211
  raise Puppet::Error, _("No private key with which to validate certificate with fingerprint: %{fingerprint}") % { fingerprint: certificate.fingerprint } unless key
212
212
  unless certificate.content.check_private_key(key.content)
213
- raise Puppet::Error, _(<<ERROR_STRING) % { fingerprint: certificate.fingerprint, cert_name: Puppet[:certname], ssl_dir: Puppet[:ssldir], cert_dir: Puppet[:certdir].gsub('/', '\\') }
213
+ raise Puppet::Error, _(<<ERROR_STRING) % { fingerprint: certificate.fingerprint, cert_name: Puppet[:certname], ssl_dir: Puppet[:ssldir], cert_dir: Puppet[:certdir].tr('/', '\\') }
214
214
  The certificate retrieved from the master does not match the agent's private key. Did you forget to run as root?
215
215
  Certificate fingerprint: %{fingerprint}
216
216
  To fix this, remove the certificate from both the master and the agent and then start a puppet run, which will automatically regenerate a certificate.
@@ -235,7 +235,7 @@ ERROR_STRING
235
235
  if !existing_request.nil? &&
236
236
  (key.content.public_key.to_s != existing_request.content.public_key.to_s)
237
237
 
238
- raise Puppet::Error, _(<<ERROR_STRING) % { fingerprint: existing_request.fingerprint, csr_public_key: existing_request.content.public_key.to_text, agent_public_key: key.content.public_key.to_text, cert_name: Puppet[:certname], ssl_dir: Puppet[:ssldir], cert_dir: Puppet[:certdir].gsub('/', '\\') }
238
+ raise Puppet::Error, _(<<ERROR_STRING) % { fingerprint: existing_request.fingerprint, csr_public_key: existing_request.content.public_key.to_text, agent_public_key: key.content.public_key.to_text, cert_name: Puppet[:certname], ssl_dir: Puppet[:ssldir], cert_dir: Puppet[:certdir].tr('/', '\\') }
239
239
  The CSR retrieved from the master does not match the agent's public key.
240
240
  CSR fingerprint: %{fingerprint}
241
241
  CSR public key: %{csr_public_key}
@@ -345,7 +345,7 @@ ERROR_STRING
345
345
  exit(1)
346
346
  end
347
347
 
348
- while true
348
+ loop do
349
349
  sleep time
350
350
  begin
351
351
  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 = YAML.load_file(custom_oid_file)
@@ -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|
data/lib/puppet/type.rb CHANGED
@@ -1447,7 +1447,7 @@ class Type
1447
1447
  }
1448
1448
 
1449
1449
  Tags are useful for things like applying a subset of a host's configuration
1450
- with [the `tags` setting](/puppet/latest/configuration.html#tags)
1450
+ with [the `tags` setting](https://puppet.com/docs/puppet/latest/configuration.html#tags)
1451
1451
  (e.g. `puppet agent --test --tags bootstrap`)."
1452
1452
 
1453
1453
  munge do |tags|
@@ -1909,9 +1909,7 @@ end
1909
1909
  # Since we're mixing @doc with text from other sources, we must normalize
1910
1910
  # its indentation with scrub. But we don't need to manually scrub the
1911
1911
  # provider's doc string, since markdown_definitionlist sanitizes its inputs.
1912
- scrub(@doc) + "Available providers are:\n\n" + parenttype.providers.sort { |a,b|
1913
- a.to_s <=> b.to_s
1914
- }.collect { |i|
1912
+ scrub(@doc) + "Available providers are:\n\n" + parenttype.providers.sort_by(&:to_s).collect { |i|
1915
1913
  markdown_definitionlist( i, scrub(parenttype().provider(i).doc) )
1916
1914
  }.join
1917
1915
  end
@@ -98,7 +98,7 @@ Puppet::Type.newtype(:cron) do
98
98
  # if we can lengthen it (e.g., mon => monday).
99
99
  if tmp.length == 3
100
100
  ary.each_with_index { |name, index|
101
- if tmp.upcase == name[0..2].upcase
101
+ if tmp.casecmp(name[0..2]).zero?
102
102
  return index
103
103
  end
104
104
  }
@@ -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
 
@@ -572,8 +572,7 @@ Puppet::Type.newtype(:file) do
572
572
  # remote system.
573
573
  mark_children_for_purging(children) if self.purge?
574
574
 
575
- # REVISIT: sort_by is more efficient?
576
- result = children.values.sort { |a, b| a[:path] <=> b[:path] }
575
+ result = children.values.sort_by { |a| a[:path] }
577
576
  remove_less_specific_files(result)
578
577
  end
579
578
 
@@ -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
 
@@ -105,7 +105,7 @@ Puppet::Type.newtype(:interface) do
105
105
 
106
106
  def value_to_s(value)
107
107
  value = [value] unless value.is_a?(Array)
108
- value.map{ |v| "#{v[1].to_s}/#{v[0]} #{v[2]}"}.join(",")
108
+ value.map{ |v| "#{v[1]}/#{v[0]} #{v[2]}"}.join(",")
109
109
  end
110
110
 
111
111
  def change_to_s(currentvalue, newvalue)
@@ -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
@@ -481,8 +481,8 @@ module Puppet
481
481
  end
482
482
 
483
483
  newparam(:flavor) do
484
- desc "OpenBSD supports 'flavors', which are further specifications for
485
- which type of package you want."
484
+ desc "OpenBSD and DNF modules support 'flavors', which are
485
+ further specifications for which type of package you want."
486
486
  end
487
487
 
488
488
  newparam(:install_only, :boolean => false, :parent => Puppet::Parameter::Boolean, :required_features => :install_only) do
@@ -389,7 +389,7 @@ module Puppet
389
389
  end
390
390
 
391
391
  def weekday_integer?(value)
392
- value.is_a?(Integer) && (0..6).include?(value)
392
+ value.is_a?(Integer) && (0..6).cover?(value)
393
393
  end
394
394
 
395
395
  def weekday_string?(value)
@@ -9,9 +9,23 @@ module Puppet
9
9
  end
10
10
 
11
11
  newproperty(:value) do
12
- desc "Whether the SELinux boolean should be enabled or disabled."
13
- newvalue(:on)
14
- newvalue(:off)
12
+ value_doc = 'Valid values are: "on"/"true"/"off"/"false"'
13
+ desc <<-EOT
14
+ Whether the SELinux boolean should be enabled or disabled.
15
+ #{value_doc}
16
+ EOT
17
+
18
+ newvalues(:on, :off, :true, :false)
19
+ munge do |value|
20
+ case value
21
+ when true, :true, 'true', :on, 'on'
22
+ :on
23
+ when false, :false, 'false', :off, 'off'
24
+ :off
25
+ else
26
+ raise ArgumentError, _("Invalid value %{value}. %{doc}") % { value: value.inspect, doc: value_doc}
27
+ end
28
+ end
15
29
  end
16
30
 
17
31
  newparam(:persistent) do
@@ -228,7 +228,7 @@ module Puppet
228
228
  desc "The control variable used to manage services (originally for HP-UX).
229
229
  Defaults to the upcased service name plus `START` replacing dots with
230
230
  underscores, for those providers that support the `controllable` feature."
231
- defaultto { resource.name.gsub(".","_").upcase + "_START" if resource.provider.controllable? }
231
+ defaultto { resource.name.tr(".","_").upcase + "_START" if resource.provider.controllable? }
232
232
  end
233
233
 
234
234
  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
@@ -665,7 +666,8 @@ module Puppet
665
666
  :required_features => :libuser,
666
667
  :parent => Puppet::Parameter::Boolean) do
667
668
  desc "Forces the management of local accounts when accounts are also
668
- being managed by some other NSS"
669
+ being managed by some other NSS. For AIX, refer to the
670
+ `ia_load_module` parameter."
669
671
  defaultto false
670
672
  end
671
673
 
data/lib/puppet/util.rb CHANGED
@@ -323,7 +323,7 @@ module Util
323
323
  params = { :scheme => 'file' }
324
324
 
325
325
  if Puppet.features.microsoft_windows?
326
- path = path.gsub(/\\/, '/')
326
+ path = path.tr('\\', '/')
327
327
 
328
328
  if unc = /^\/\/([^\/]+)(\/.+)/.match(path)
329
329
  params[:host] = unc[1]
@@ -524,21 +524,44 @@ module Util
524
524
 
525
525
  module_function :thinmark
526
526
 
527
+ PUPPET_STACK_INSERTION_FRAME = /.*puppet_stack\.rb.*in.*`stack'/
528
+
527
529
  # utility method to get the current call stack and format it to a human-readable string (which some IDEs/editors
528
530
  # will recognize as links to the line numbers in the trace)
529
- def self.pretty_backtrace(backtrace = caller(1))
530
- backtrace.collect do |line|
531
- _, path, rest = /^(.*):(\d+.*)$/.match(line).to_a
532
- # If the path doesn't exist - like in one test, and like could happen in
533
- # the world - we should just tolerate it and carry on. --daniel 2012-09-05
534
- # Also, if we don't match, just include the whole line.
535
- if path
536
- path = Pathname(path).realpath rescue path
537
- "#{path}:#{rest}"
531
+ def self.pretty_backtrace(backtrace = caller(1), puppetstack = [])
532
+ format_backtrace_array(backtrace, puppetstack).join("\n")
533
+ end
534
+
535
+ # arguments may be a Ruby stack, with an optional Puppet stack argument,
536
+ # or just a Puppet stack.
537
+ # stacks may be an Array of Strings "/foo.rb:0 in `blah'" or
538
+ # an Array of Arrays that represent a frame: ["/foo.pp", 0]
539
+ def self.format_backtrace_array(primary_stack, puppetstack = [])
540
+ primary_stack.flat_map do |frame|
541
+ frame = format_puppetstack_frame(frame) if frame.is_a?(Array)
542
+ primary_frame = resolve_stackframe(frame)
543
+
544
+ if primary_frame =~ PUPPET_STACK_INSERTION_FRAME && !puppetstack.empty?
545
+ [resolve_stackframe(format_puppetstack_frame(puppetstack.shift)),
546
+ primary_frame]
538
547
  else
539
- line
548
+ primary_frame
540
549
  end
541
- end.join("\n")
550
+ end
551
+ end
552
+
553
+ def self.resolve_stackframe(frame)
554
+ _, path, rest = /^(.*):(\d+.*)$/.match(frame).to_a
555
+ if path
556
+ path = Pathname(path).realpath rescue path
557
+ "#{path}:#{rest}"
558
+ else
559
+ frame
560
+ end
561
+ end
562
+
563
+ def self.format_puppetstack_frame(file_and_lineno)
564
+ file_and_lineno.join(':')
542
565
  end
543
566
 
544
567
  # Replace a file, securely. This takes a block, and passes it the file