puppet 5.3.3-x86-mingw32 → 5.3.4-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 (291) hide show
  1. data/CONTRIBUTING.md +1 -1
  2. data/Gemfile +3 -0
  3. data/ext/puppet-test +3 -2
  4. data/lib/hiera/puppet_function.rb +5 -2
  5. data/lib/hiera_puppet.rb +3 -3
  6. data/lib/puppet.rb +2 -5
  7. data/lib/puppet/agent.rb +22 -2
  8. data/lib/puppet/agent/locker.rb +6 -5
  9. data/lib/puppet/application.rb +18 -1
  10. data/lib/puppet/application/agent.rb +9 -2
  11. data/lib/puppet/application/apply.rb +1 -1
  12. data/lib/puppet/application/config.rb +1 -0
  13. data/lib/puppet/application/device.rb +1 -2
  14. data/lib/puppet/application/filebucket.rb +22 -5
  15. data/lib/puppet/application/help.rb +1 -0
  16. data/lib/puppet/application/lookup.rb +1 -3
  17. data/lib/puppet/application_support.rb +6 -1
  18. data/lib/puppet/bindings.rb +2 -1
  19. data/lib/puppet/configurer.rb +9 -4
  20. data/lib/puppet/configurer/downloader_factory.rb +10 -0
  21. data/lib/puppet/configurer/plugin_handler.rb +11 -4
  22. data/lib/puppet/daemon.rb +2 -2
  23. data/lib/puppet/defaults.rb +99 -27
  24. data/lib/puppet/environments.rb +2 -0
  25. data/lib/puppet/error.rb +5 -15
  26. data/lib/puppet/external/pson/common.rb +2 -2
  27. data/lib/puppet/face/catalog.rb +1 -1
  28. data/lib/puppet/face/config.rb +14 -1
  29. data/lib/puppet/face/epp.rb +4 -2
  30. data/lib/puppet/face/help.rb +12 -14
  31. data/lib/puppet/face/man.rb +1 -0
  32. data/lib/puppet/face/module/build.rb +1 -1
  33. data/lib/puppet/face/module/list.rb +6 -17
  34. data/lib/puppet/face/module/uninstall.rb +14 -3
  35. data/lib/puppet/face/node.rb +1 -0
  36. data/lib/puppet/face/status.rb +1 -0
  37. data/lib/puppet/file_serving/base.rb +2 -1
  38. data/lib/puppet/file_serving/configuration.rb +3 -0
  39. data/lib/puppet/file_serving/configuration/parser.rb +23 -9
  40. data/lib/puppet/file_serving/mount/locales.rb +35 -0
  41. data/lib/puppet/forge.rb +2 -1
  42. data/lib/puppet/forge/errors.rb +24 -22
  43. data/lib/puppet/functions/binary_file.rb +1 -0
  44. data/lib/puppet/functions/each.rb +10 -4
  45. data/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
  46. data/lib/puppet/functions/lookup.rb +2 -2
  47. data/lib/puppet/functions/map.rb +12 -2
  48. data/lib/puppet/functions/slice.rb +2 -3
  49. data/lib/puppet/functions/unique.rb +1 -1
  50. data/lib/puppet/functions/yaml_data.rb +1 -1
  51. data/lib/puppet/gettext/config.rb +144 -41
  52. data/lib/puppet/gettext/module_translations.rb +42 -0
  53. data/lib/puppet/graph/relationship_graph.rb +1 -1
  54. data/lib/puppet/graph/simple_graph.rb +3 -3
  55. data/lib/puppet/indirector/catalog/compiler.rb +40 -25
  56. data/lib/puppet/indirector/exec.rb +1 -1
  57. data/lib/puppet/indirector/facts/facter.rb +3 -3
  58. data/lib/puppet/indirector/facts/network_device.rb +2 -2
  59. data/lib/puppet/indirector/file_bucket_file/file.rb +4 -1
  60. data/lib/puppet/indirector/indirection.rb +17 -9
  61. data/lib/puppet/indirector/ldap.rb +2 -2
  62. data/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
  63. data/lib/puppet/indirector/rest.rb +8 -5
  64. data/lib/puppet/indirector/ssl_file.rb +2 -2
  65. data/lib/puppet/indirector/terminus.rb +3 -3
  66. data/lib/puppet/interface.rb +2 -1
  67. data/lib/puppet/interface/action.rb +41 -24
  68. data/lib/puppet/interface/action_builder.rb +14 -5
  69. data/lib/puppet/interface/action_manager.rb +1 -1
  70. data/lib/puppet/interface/documentation.rb +21 -10
  71. data/lib/puppet/interface/face_collection.rb +4 -2
  72. data/lib/puppet/interface/option.rb +36 -15
  73. data/lib/puppet/interface/option_builder.rb +23 -9
  74. data/lib/puppet/interface/option_manager.rb +8 -3
  75. data/lib/puppet/metatype/manager.rb +7 -3
  76. data/lib/puppet/module.rb +18 -21
  77. data/lib/puppet/module_tool/errors/installer.rb +18 -20
  78. data/lib/puppet/module_tool/errors/shared.rb +20 -15
  79. data/lib/puppet/module_tool/errors/uninstaller.rb +1 -0
  80. data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
  81. data/lib/puppet/module_tool/tar/mini.rb +57 -4
  82. data/lib/puppet/network/auth_config_parser.rb +18 -13
  83. data/lib/puppet/network/authstore.rb +2 -2
  84. data/lib/puppet/network/client_request.rb +1 -1
  85. data/lib/puppet/network/format.rb +3 -3
  86. data/lib/puppet/network/http/api/indirection_type.rb +1 -1
  87. data/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
  88. data/lib/puppet/network/http/error.rb +7 -7
  89. data/lib/puppet/network/http/factory.rb +9 -0
  90. data/lib/puppet/network/http/rack.rb +2 -2
  91. data/lib/puppet/network/http/webrick.rb +2 -4
  92. data/lib/puppet/node.rb +25 -6
  93. data/lib/puppet/node/environment.rb +14 -0
  94. data/lib/puppet/node/facts.rb +9 -0
  95. data/lib/puppet/parameter.rb +3 -3
  96. data/lib/puppet/parameter/value_collection.rb +9 -9
  97. data/lib/puppet/parser/ast/leaf.rb +1 -1
  98. data/lib/puppet/parser/ast/node.rb +2 -2
  99. data/lib/puppet/parser/ast/pops_bridge.rb +1 -1
  100. data/lib/puppet/parser/compiler.rb +6 -5
  101. data/lib/puppet/parser/functions.rb +1 -1
  102. data/lib/puppet/parser/functions/generate.rb +2 -4
  103. data/lib/puppet/parser/functions/inline_template.rb +1 -2
  104. data/lib/puppet/parser/functions/sprintf.rb +17 -3
  105. data/lib/puppet/parser/functions/template.rb +6 -2
  106. data/lib/puppet/parser/resource.rb +30 -31
  107. data/lib/puppet/parser/scope.rb +20 -11
  108. data/lib/puppet/parser/templatewrapper.rb +4 -3
  109. data/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
  110. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
  111. data/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
  112. data/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
  113. data/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
  114. data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
  115. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
  116. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  117. data/lib/puppet/pops/functions/dispatch.rb +1 -1
  118. data/lib/puppet/pops/functions/function.rb +8 -2
  119. data/lib/puppet/pops/issue_reporter.rb +7 -2
  120. data/lib/puppet/pops/issues.rb +10 -4
  121. data/lib/puppet/pops/label_provider.rb +1 -1
  122. data/lib/puppet/pops/loader/module_loaders.rb +5 -2
  123. data/lib/puppet/pops/loader/static_loader.rb +1 -1
  124. data/lib/puppet/pops/loaders.rb +7 -3
  125. data/lib/puppet/pops/lookup/explainer.rb +2 -1
  126. data/lib/puppet/pops/lookup/hiera_config.rb +2 -2
  127. data/lib/puppet/pops/lookup/lookup_adapter.rb +4 -4
  128. data/lib/puppet/pops/merge_strategy.rb +6 -3
  129. data/lib/puppet/pops/migration/migration_checker.rb +8 -8
  130. data/lib/puppet/pops/model/ast_transformer.rb +1 -1
  131. data/lib/puppet/pops/model/factory.rb +4 -2
  132. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  133. data/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
  134. data/lib/puppet/pops/types/iterable.rb +2 -0
  135. data/lib/puppet/pops/types/p_object_type.rb +36 -15
  136. data/lib/puppet/pops/types/type_calculator.rb +2 -1
  137. data/lib/puppet/pops/types/type_factory.rb +3 -1
  138. data/lib/puppet/pops/types/type_mismatch_describer.rb +19 -6
  139. data/lib/puppet/pops/types/type_parser.rb +7 -7
  140. data/lib/puppet/pops/types/types.rb +10 -4
  141. data/lib/puppet/pops/validation.rb +14 -12
  142. data/lib/puppet/property.rb +14 -6
  143. data/lib/puppet/property/ensure.rb +2 -2
  144. data/lib/puppet/provider.rb +4 -4
  145. data/lib/puppet/provider/group/aix.rb +4 -2
  146. data/lib/puppet/provider/ldap.rb +2 -2
  147. data/lib/puppet/provider/naginator.rb +1 -1
  148. data/lib/puppet/provider/nameservice.rb +7 -4
  149. data/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
  150. data/lib/puppet/provider/package/aix.rb +1 -1
  151. data/lib/puppet/provider/package/nim.rb +7 -8
  152. data/lib/puppet/provider/package/opkg.rb +1 -1
  153. data/lib/puppet/provider/package/pkg.rb +9 -6
  154. data/lib/puppet/provider/package/pkgutil.rb +3 -3
  155. data/lib/puppet/provider/package/yum.rb +1 -1
  156. data/lib/puppet/provider/parsedfile.rb +4 -4
  157. data/lib/puppet/provider/selmodule/semodule.rb +5 -3
  158. data/lib/puppet/provider/service/base.rb +1 -1
  159. data/lib/puppet/provider/service/init.rb +1 -1
  160. data/lib/puppet/provider/service/launchd.rb +2 -2
  161. data/lib/puppet/provider/service/runit.rb +2 -1
  162. data/lib/puppet/provider/service/smf.rb +2 -0
  163. data/lib/puppet/provider/service/systemd.rb +1 -0
  164. data/lib/puppet/provider/service/upstart.rb +1 -1
  165. data/lib/puppet/provider/user/aix.rb +13 -6
  166. data/lib/puppet/provider/user/openbsd.rb +2 -1
  167. data/lib/puppet/provider/yumrepo/inifile.rb +2 -1
  168. data/lib/puppet/provider/zone/solaris.rb +2 -2
  169. data/lib/puppet/reference/configuration.rb +4 -2
  170. data/lib/puppet/relationship.rb +2 -1
  171. data/lib/puppet/reports/store.rb +1 -1
  172. data/lib/puppet/resource.rb +7 -5
  173. data/lib/puppet/resource/capability_finder.rb +14 -11
  174. data/lib/puppet/resource/catalog.rb +33 -18
  175. data/lib/puppet/resource/type.rb +5 -5
  176. data/lib/puppet/settings.rb +19 -13
  177. data/lib/puppet/settings/base_setting.rb +23 -8
  178. data/lib/puppet/settings/config_file.rb +14 -4
  179. data/lib/puppet/settings/environment_conf.rb +19 -9
  180. data/lib/puppet/ssl/base.rb +9 -4
  181. data/lib/puppet/ssl/oids.rb +8 -2
  182. data/lib/puppet/syntax_checkers/base64.rb +5 -6
  183. data/lib/puppet/transaction.rb +7 -3
  184. data/lib/puppet/transaction/persistence.rb +16 -1
  185. data/lib/puppet/transaction/report.rb +6 -0
  186. data/lib/puppet/type.rb +27 -35
  187. data/lib/puppet/type/file.rb +2 -1
  188. data/lib/puppet/type/file/data_sync.rb +2 -1
  189. data/lib/puppet/type/file/source.rb +1 -1
  190. data/lib/puppet/type/group.rb +1 -1
  191. data/lib/puppet/type/mount.rb +1 -1
  192. data/lib/puppet/type/resources.rb +1 -1
  193. data/lib/puppet/type/schedule.rb +26 -14
  194. data/lib/puppet/type/user.rb +9 -3
  195. data/lib/puppet/type/zone.rb +1 -1
  196. data/lib/puppet/util.rb +27 -21
  197. data/lib/puppet/util/at_fork/solaris.rb +6 -4
  198. data/lib/puppet/util/command_line.rb +5 -0
  199. data/lib/puppet/util/command_line/trollop.rb +6 -5
  200. data/lib/puppet/util/errors.rb +61 -8
  201. data/lib/puppet/util/fileparsing.rb +3 -5
  202. data/lib/puppet/util/http_proxy.rb +14 -6
  203. data/lib/puppet/util/instance_loader.rb +1 -3
  204. data/lib/puppet/util/ldap/manager.rb +6 -3
  205. data/lib/puppet/util/log.rb +19 -24
  206. data/lib/puppet/util/logging.rb +21 -28
  207. data/lib/puppet/util/methodhelper.rb +1 -1
  208. data/lib/puppet/util/nagios_maker.rb +1 -1
  209. data/lib/puppet/util/network_device/config.rb +21 -13
  210. data/lib/puppet/util/plist.rb +3 -1
  211. data/lib/puppet/util/posix.rb +1 -1
  212. data/lib/puppet/util/provider_features.rb +1 -1
  213. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
  214. data/lib/puppet/util/reference.rb +2 -3
  215. data/lib/puppet/util/selinux.rb +1 -1
  216. data/lib/puppet/util/storage.rb +2 -2
  217. data/lib/puppet/util/windows/eventlog.rb +10 -5
  218. data/lib/puppet/util/windows/file.rb +61 -9
  219. data/lib/puppet/util/windows/process.rb +1 -1
  220. data/lib/puppet/util/windows/taskscheduler.rb +2 -2
  221. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +5 -1
  222. data/lib/puppet/version.rb +1 -1
  223. data/locales/en/puppet.po +19 -0
  224. data/locales/ja/puppet.po +2739 -809
  225. data/locales/puppet.pot +2367 -734
  226. data/spec/fixtures/unit/application/environments/production/data/common.yaml +2 -0
  227. data/spec/integration/agent/logging_spec.rb +2 -0
  228. data/spec/integration/faces/plugin_spec.rb +1 -0
  229. data/spec/integration/network/authconfig_spec.rb +2 -2
  230. data/spec/integration/parser/collection_spec.rb +2 -2
  231. data/spec/integration/parser/scope_spec.rb +16 -3
  232. data/spec/integration/provider/cron/crontab_spec.rb +1 -0
  233. data/spec/integration/transaction/report_spec.rb +5 -0
  234. data/spec/lib/matchers/json.rb +14 -13
  235. data/spec/unit/agent_spec.rb +33 -0
  236. data/spec/unit/application/config_spec.rb +4 -0
  237. data/spec/unit/application/lookup_spec.rb +30 -0
  238. data/spec/unit/application_spec.rb +18 -0
  239. data/spec/unit/configurer/downloader_factory_spec.rb +33 -0
  240. data/spec/unit/configurer/plugin_handler_spec.rb +71 -16
  241. data/spec/unit/environments_spec.rb +15 -0
  242. data/spec/unit/face/config_spec.rb +8 -9
  243. data/spec/unit/face/epp_face_spec.rb +2 -2
  244. data/spec/unit/face/plugin_spec.rb +50 -4
  245. data/spec/unit/file_serving/configuration/parser_spec.rb +2 -2
  246. data/spec/unit/file_serving/mount/locales_spec.rb +73 -0
  247. data/spec/unit/functions/break_spec.rb +108 -50
  248. data/spec/unit/functions/defined_spec.rb +2 -2
  249. data/spec/unit/functions/hiera_spec.rb +0 -1
  250. data/spec/unit/functions/lookup_spec.rb +85 -19
  251. data/spec/unit/functions/next_spec.rb +1 -1
  252. data/spec/unit/functions/return_spec.rb +2 -2
  253. data/spec/unit/gettext/config_spec.rb +125 -0
  254. data/spec/unit/gettext/module_loading_spec.rb +53 -0
  255. data/spec/unit/indirector/json_spec.rb +0 -11
  256. data/spec/unit/indirector/node/exec_spec.rb +1 -1
  257. data/spec/unit/info_service_spec.rb +1 -1
  258. data/spec/unit/interface_spec.rb +12 -0
  259. data/spec/unit/module_spec.rb +0 -28
  260. data/spec/unit/module_tool/tar/mini_spec.rb +34 -5
  261. data/spec/unit/network/http/factory_spec.rb +22 -0
  262. data/spec/unit/network/http/webrick_spec.rb +30 -29
  263. data/spec/unit/node/environment_spec.rb +16 -0
  264. data/spec/unit/node_spec.rb +102 -16
  265. data/spec/unit/parser/environment_compiler_spec.rb +1 -1
  266. data/spec/unit/parser/functions/sprintf_spec.rb +26 -0
  267. data/spec/unit/parser/resource/param_spec.rb +1 -1
  268. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +9 -9
  269. data/spec/unit/pops/loaders/static_loader_spec.rb +1 -1
  270. data/spec/unit/pops/parser/parse_containers_spec.rb +1 -1
  271. data/spec/unit/pops/types/type_calculator_spec.rb +40 -0
  272. data/spec/unit/pops/types/type_mismatch_describer_spec.rb +9 -0
  273. data/spec/unit/provider/selmodule_spec.rb +6 -0
  274. data/spec/unit/provider/service/init_spec.rb +1 -1
  275. data/spec/unit/provider/service/smf_spec.rb +2 -0
  276. data/spec/unit/provider/service/systemd_spec.rb +14 -0
  277. data/spec/unit/resource/catalog_spec.rb +12 -2
  278. data/spec/unit/settings/config_file_spec.rb +1 -1
  279. data/spec/unit/transaction/persistence_spec.rb +42 -0
  280. data/spec/unit/transaction/report_spec.rb +19 -4
  281. data/spec/unit/transaction_spec.rb +27 -0
  282. data/spec/unit/type/schedule_spec.rb +14 -0
  283. data/spec/unit/type_spec.rb +3 -3
  284. data/spec/unit/util/errors_spec.rb +1 -1
  285. data/spec/unit/util/http_proxy_spec.rb +37 -0
  286. data/spec/unit/util/log_spec.rb +3 -3
  287. data/spec/unit/util/logging_spec.rb +7 -7
  288. data/spec/unit/util/monkey_patches_spec.rb +6 -2
  289. metadata +3445 -3416
  290. checksums.yaml +0 -7
  291. data/spec/unit/gettext_config_spec.rb +0 -57
@@ -189,7 +189,8 @@ Puppet::Type.type(:yumrepo).provide(:inifile) do
189
189
  inifile.each_file do |file|
190
190
  current_mode = Puppet::FileSystem.stat(file).mode & 0777
191
191
  unless current_mode == target_mode
192
- resource.info "changing mode of #{file} from %03o to %03o" % [current_mode, target_mode]
192
+ resource.info _("changing mode of %{file} from %{current_mode} to %{target_mode}") %
193
+ { file: file, current_mode: "%03o" % current_mode, target_mode: "%03o" % target_mode }
193
194
  Puppet::FileSystem.chmod(target_mode, file)
194
195
  end
195
196
  end
@@ -81,7 +81,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
81
81
  elsif interface
82
82
  "remove net physical=#{interface}"
83
83
  else
84
- raise ArgumentError, "can not remove network based on default router"
84
+ raise ArgumentError, _("can not remove network based on default router")
85
85
  end
86
86
  else self.fail action
87
87
  end
@@ -155,7 +155,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
155
155
  command = "#{command(:cfg)} -z #{@resource[:name]} -f -"
156
156
  r = exec_cmd(:cmd => command, :input => str)
157
157
  if r[:exit] != 0 or r[:out] =~ /not allowed/
158
- raise ArgumentError, "Failed to apply configuration"
158
+ raise ArgumentError, _("Failed to apply configuration")
159
159
  end
160
160
  end
161
161
 
@@ -48,7 +48,7 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
48
48
  end
49
49
 
50
50
  config.header = <<EOT
51
- ## Configuration Settings
51
+ ## Configuration settings
52
52
 
53
53
  * Each of these settings can be specified in `puppet.conf` or on the
54
54
  command line.
@@ -67,6 +67,8 @@ config.header = <<EOT
67
67
  combined with other units, and defaults to seconds when omitted. Examples are
68
68
  '3600' which is equivalent to '1h' (one hour), and '1825d' which is equivalent
69
69
  to '5y' (5 years).
70
+ * If you use the `splay` setting, note that the period that it waits changes
71
+ each time the Puppet agent is restarted.
70
72
  * Settings that take a single file or directory can optionally set the owner,
71
73
  group, and mode for their value: `rundir = $vardir/run { owner = puppet,
72
74
  group = puppet, mode = 644 }`
@@ -75,7 +77,7 @@ config.header = <<EOT
75
77
 
76
78
  See the [configuration guide][confguide] for more details.
77
79
 
78
- [confguide]: https://docs.puppetlabs.com/puppet/latest/reference/config_about_settings.html
80
+ [confguide]: https://puppet.com/docs/puppet/latest/config_about_settings.html
79
81
 
80
82
  * * *
81
83
 
@@ -30,7 +30,8 @@ class Puppet::Relationship
30
30
  end
31
31
 
32
32
  def event=(event)
33
- raise ArgumentError, "You must pass a callback for non-NONE events" if event != :NONE and ! callback
33
+ #TRANSLATORS 'NONE' should not be translated
34
+ raise ArgumentError, _("You must pass a callback for non-NONE events") if event != :NONE and ! callback
34
35
  @event = event
35
36
  end
36
37
 
@@ -61,7 +61,7 @@ Puppet::Reports.register_report(:store) do
61
61
 
62
62
  def validate_host(host)
63
63
  if host =~ Regexp.union(/[#{SEPARATOR}]/, /\A\.\.?\Z/)
64
- raise ArgumentError, "Invalid node name #{host.inspect}"
64
+ raise ArgumentError, _("Invalid node name %{host}") % { host: host.inspect }
65
65
  end
66
66
  end
67
67
  module_function :validate_host
@@ -251,8 +251,10 @@ class Puppet::Resource
251
251
  @sensitive_parameters.replace(type.sensitive_parameters)
252
252
  else
253
253
  if type.is_a?(Hash)
254
- raise ArgumentError, "Puppet::Resource.new does not take a hash as the first argument. "+
255
- "Did you mean (#{(type[:type] || type["type"]).inspect}, #{(type[:title] || type["title"]).inspect }) ?"
254
+ #TRANSLATORS 'Puppet::Resource.new' should not be translated
255
+ raise ArgumentError, _("Puppet::Resource.new does not take a hash as the first argument.") + ' ' +
256
+ _("Did you mean (%{type}, %{title}) ?") %
257
+ { type: (type[:type] || type["type"]).inspect, title: (type[:title] || type["title"]).inspect }
256
258
  end
257
259
 
258
260
  environment = attributes[:environment]
@@ -289,9 +291,9 @@ class Puppet::Resource
289
291
 
290
292
  if strict? && rt.nil?
291
293
  if self.class?
292
- raise ArgumentError, "Could not find declared class #{title}"
294
+ raise ArgumentError, _("Could not find declared class %{title}") % { title: title }
293
295
  else
294
- raise ArgumentError, "Invalid resource type #{type}"
296
+ raise ArgumentError, _("Invalid resource type %{type}") % { type: type }
295
297
  end
296
298
  end
297
299
 
@@ -588,7 +590,7 @@ class Puppet::Resource
588
590
  elsif argtitle.nil? && argtype =~ /^([^\[\]]+)\[(.+)\]$/m then [ $1, $2 ]
589
591
  elsif argtitle then [ argtype, argtitle ]
590
592
  elsif argtype.is_a?(Puppet::Type) then [ argtype.class.name, argtype.title ]
591
- else raise ArgumentError, "No title provided and #{argtype.inspect} is not a valid resource reference"
593
+ else raise ArgumentError, _("No title provided and %{type} is not a valid resource reference") % { type: argtype.inspect }
592
594
  end
593
595
  end
594
596
  private_class_method :extract_type_and_title
@@ -23,7 +23,8 @@ module Puppet::Resource::CapabilityFinder
23
23
  # @return [Puppet::Resource,nil] The found capability resource or `nil` if it could not be found
24
24
  def self.find(environment, code_id, cap)
25
25
  unless Puppet::Util.const_defined?('Puppetdb')
26
- raise Puppet::DevError, 'PuppetDB is not available'
26
+ #TRANSLATOR PuppetDB is a product name and should not be translated
27
+ raise Puppet::DevError, _('PuppetDB is not available')
27
28
  end
28
29
 
29
30
  resources = search(nil, nil, cap)
@@ -40,10 +41,11 @@ module Puppet::Resource::CapabilityFinder
40
41
  elsif code_id_resource = disambiguate_by_code_id(environment, code_id, cap)
41
42
  resource_hash = code_id_resource
42
43
  else
43
- raise Puppet::DevError,
44
- "Unexpected response from PuppetDB when looking up #{cap}:\n" \
45
- "expected exactly one resource but got #{resources.size};\n" \
46
- "returned data is:\n#{resources.inspect}"
44
+ #TRANSLATOR PuppetDB is a product name and should not be translated
45
+ message = _("Unexpected response from PuppetDB when looking up %{capability}:") % { capability: cap }
46
+ message += "\n" + _("expected exactly one resource but got %{count};") % { count: resources.size }
47
+ message += "\n" + _("returned data is:\n%{resources}") % { resources: resources.inspect }
48
+ raise Puppet::DevError, message
47
49
  end
48
50
 
49
51
  if resource_hash
@@ -72,7 +74,8 @@ module Puppet::Resource::CapabilityFinder
72
74
  ['=', 'code_id', code_id]]]]
73
75
  end
74
76
 
75
- Puppet.notice _("Looking up capability %{cap} in PuppetDB: %{query_terms}") % { cap: cap, query_terms: query_terms }
77
+ #TRANSLATOR PuppetDB is a product name and should not be translated
78
+ Puppet.notice _("Looking up capability %{capability} in PuppetDB: %{query_terms}") % { capability: cap, query_terms: query_terms }
76
79
 
77
80
  query_puppetdb(query_terms)
78
81
  end
@@ -95,15 +98,15 @@ module Puppet::Resource::CapabilityFinder
95
98
  # The format of the response body is documented at
96
99
  # https://docs.puppetlabs.com/puppetdb/3.0/api/query/v4/resources.html#response-format
97
100
  unless result.is_a?(Array)
98
- raise Puppet::DevError,
99
- "Unexpected response from PuppetDB when looking up #{cap}: " \
100
- "expected an Array but got #{result.inspect}"
101
+ #TRANSLATOR PuppetDB is a product name and should not be translated
102
+ raise Puppet::DevError, _("Unexpected response from PuppetDB when looking up %{capability}: expected an Array but got %{result}") %
103
+ { capability: cap, result: result.inspect }
101
104
  end
102
105
 
103
106
  result
104
107
  rescue JSON::JSONError => e
105
- raise Puppet::DevError,
106
- "Invalid JSON from PuppetDB when looking up #{cap}\n#{e}"
108
+ #TRANSLATOR PuppetDB is a product name and should not be translated
109
+ raise Puppet::DevError, _("Invalid JSON from PuppetDB when looking up %{capability}\n%{detail}") % { capability: cap, detail: e }
107
110
  end
108
111
  end
109
112
 
@@ -100,7 +100,10 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
100
100
  resources.each do |resource|
101
101
  other_title_key = title_key_for_ref(other.ref)
102
102
  idx = @resources.index(other_title_key)
103
- raise ArgumentError, "Cannot add resource #{resource.ref} before #{other.ref} because #{other.ref} is not yet in the catalog" if idx.nil?
103
+ if idx.nil?
104
+ raise ArgumentError, _("Cannot add resource %{resource_1} before %{resource_2} because %{resource_2} is not yet in the catalog") %
105
+ { resource_1: resource.ref, resource_2: other.ref }
106
+ end
104
107
  add_one_resource(resource, idx)
105
108
  end
106
109
  end
@@ -112,7 +115,10 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
112
115
  resources.each do |resource|
113
116
  other_title_key = title_key_for_ref(other.ref)
114
117
  idx = @resources.index(other_title_key)
115
- raise ArgumentError, "Cannot add resource #{resource.ref} after #{other.ref} because #{other.ref} is not yet in the catalog" if idx.nil?
118
+ if idx.nil?
119
+ raise ArgumentError, _("Cannot add resource %{resource_1} after %{resource_2} because %{resource_2} is not yet in the catalog") %
120
+ { resource_1: resource.ref, resource_2: other.ref }
121
+ end
116
122
  add_one_resource(resource, idx+1)
117
123
  end
118
124
  end
@@ -193,10 +199,17 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
193
199
  # isn't sufficient.
194
200
  if existing = @resource_table[newref]
195
201
  return if existing == resource
196
- resource_declaration = " at #{resource.file}:#{resource.line}" if resource.file and resource.line
197
- existing_declaration = " at #{existing.file}:#{existing.line}" if existing.file and existing.line
198
- #TRANSLATORS "resource" here is a Puppet type and should not be translated
199
- msg = _("Cannot alias %{ref} to %{key}%{resource_declaration}; resource %{newref} already declared%{existing_declaration}") % { ref: ref, key: key.inspect, resource_declaration: resource_declaration, newref: newref.inspect, existing_declaration: existing_declaration }
202
+ resource_declaration = Puppet::Util::Errors.error_location(resource.file, resource.line)
203
+ msg = if resource_declaration.empty?
204
+ #TRANSLATORS 'alias' should not be translated
205
+ _("Cannot alias %{resource} to %{key}; resource %{newref} already declared") %
206
+ { resource: ref, key: key.inspect, newref: newref.inspect }
207
+ else
208
+ #TRANSLATORS 'alias' should not be translated
209
+ _("Cannot alias %{resource} to %{key} at %{resource_declaration}; resource %{newref} already declared") %
210
+ { resource: ref, key: key.inspect, resource_declaration: resource_declaration, newref: newref.inspect }
211
+ end
212
+ msg += Puppet::Util::Errors.error_location_with_space(existing.file, existing.line)
200
213
  raise ArgumentError, msg
201
214
  end
202
215
  @resource_table[newref] = resource
@@ -271,7 +284,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
271
284
  # Create a new resource and register it in the catalog.
272
285
  def create_resource(type, options)
273
286
  unless klass = Puppet::Type.type(type)
274
- raise ArgumentError, "Unknown resource type #{type}"
287
+ raise ArgumentError, _("Unknown resource type %{type}") % { type: type }
275
288
  end
276
289
  return unless resource = klass.new(options)
277
290
 
@@ -433,12 +446,14 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
433
446
  edges.each do |edge_hash|
434
447
  edge = Puppet::Relationship.from_data_hash(edge_hash)
435
448
  unless source = result.resource(edge.source)
436
- raise ArgumentError, "Could not intern from data: Could not find relationship source #{edge.source.inspect} for #{edge.target.to_s}"
449
+ raise ArgumentError, _("Could not intern from data: Could not find relationship source %{source} for %{target}") %
450
+ { source: edge.source.inspect, target: edge.target.to_s }
437
451
  end
438
452
  edge.source = source
439
453
 
440
454
  unless target = result.resource(edge.target)
441
- raise ArgumentError, "Could not intern from data: Could not find relationship target #{edge.target.inspect} for #{edge.source.to_s}"
455
+ raise ArgumentError, _("Could not intern from data: Could not find relationship target %{target} for %{source}") %
456
+ { target: edge.target.inspect, source: edge.source.to_s }
442
457
  end
443
458
  edge.target = target
444
459
 
@@ -572,7 +587,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
572
587
  when "random"
573
588
  Puppet::Graph::RandomPrioritizer.new
574
589
  else
575
- raise Puppet::DevError, "Unknown ordering type #{Puppet[:ordering]}"
590
+ raise Puppet::DevError, _("Unknown ordering type %{ordering}") % { ordering: Puppet[:ordering] }
576
591
  end
577
592
  end
578
593
 
@@ -591,12 +606,12 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
591
606
  return unless existing_resource = @resource_table[title_key]
592
607
 
593
608
  # If we've gotten this far, it's a real conflict
594
- msg = "Duplicate declaration: #{resource.ref} is already declared"
595
-
596
- msg << " in file #{existing_resource.file}:#{existing_resource.line}" if existing_resource.file and existing_resource.line
597
-
598
- msg << "; cannot redeclare"
599
-
609
+ error_location_str = Puppet::Util::Errors.error_location(existing_resource.file, existing_resource.line)
610
+ msg = if error_location_str.empty?
611
+ _("Duplicate declaration: %{resource} is already declared; cannot redeclare") % { resource: resource.ref }
612
+ else
613
+ _("Duplicate declaration: %{resource} is already declared at %{error_location}; cannot redeclare") % { resource: resource.ref, error_location: error_location_str }
614
+ end
600
615
  raise DuplicateResourceError.new(msg, resource.file, resource.line)
601
616
  end
602
617
 
@@ -643,11 +658,11 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
643
658
  next if block_given? and yield edge.target
644
659
 
645
660
  unless source = map[edge.source.ref]
646
- raise Puppet::DevError, "Could not find resource #{edge.source.ref} when converting #{message} resources"
661
+ raise Puppet::DevError, _("Could not find resource %{resource} when converting %{message} resources") % { resource: edge.source.ref, message: message }
647
662
  end
648
663
 
649
664
  unless target = map[edge.target.ref]
650
- raise Puppet::DevError, "Could not find resource #{edge.target.ref} when converting #{message} resources"
665
+ raise Puppet::DevError, _("Could not find resource %{resource} when converting %{message} resources") % { resource: edge.target.ref, message: message }
651
666
  end
652
667
 
653
668
  result.add_edge(source, target, edge.label)
@@ -140,7 +140,7 @@ class Puppet::Resource::Type
140
140
 
141
141
  def initialize(type, name, options = {})
142
142
  @type = type.to_s.downcase.to_sym
143
- raise ArgumentError, "Invalid resource supertype '#{type}'" unless RESOURCE_KINDS.include?(@type)
143
+ raise ArgumentError, _("Invalid resource supertype '%{type}'") % { type: type } unless RESOURCE_KINDS.include?(@type)
144
144
 
145
145
  name = convert_from_ast(name) if name.is_a?(Puppet::Parser::AST::HostName)
146
146
 
@@ -223,7 +223,7 @@ class Puppet::Resource::Type
223
223
  resource_type =
224
224
  case type
225
225
  when :definition
226
- raise ArgumentError, 'Cannot create resources for defined resource types'
226
+ raise ArgumentError, _('Cannot create resources for defined resource types')
227
227
  when :hostclass
228
228
  :class
229
229
  when :node
@@ -420,10 +420,10 @@ class Puppet::Resource::Type
420
420
  name_to_type_hash.each do |name, t|
421
421
  # catch internal errors
422
422
  unless @arguments.include?(name)
423
- raise Puppet::DevError, "Parameter '#{name}' is given a type, but is not a valid parameter."
423
+ raise Puppet::DevError, _("Parameter '%{name}' is given a type, but is not a valid parameter.") % { name: name }
424
424
  end
425
425
  unless t.is_a? Puppet::Pops::Types::PAnyType
426
- raise Puppet::DevError, "Parameter '#{name}' is given a type that is not a Puppet Type, got #{t.class}"
426
+ raise Puppet::DevError, _("Parameter '%{name}' is given a type that is not a Puppet Type, got %{class_name}") % { name: name, class_name: t.class }
427
427
  end
428
428
  @argument_types[name] = t
429
429
  end
@@ -463,7 +463,7 @@ class Puppet::Resource::Type
463
463
  end
464
464
 
465
465
  def parent_scope(scope, klass)
466
- scope.class_scope(klass) || raise(Puppet::DevError, "Could not find scope for #{klass.name}")
466
+ scope.class_scope(klass) || raise(Puppet::DevError, _("Could not find scope for %{class_name}") % { class_name: klass.name })
467
467
  end
468
468
 
469
469
  def set_name_and_namespace(name)
@@ -256,7 +256,7 @@ class Puppet::Settings
256
256
  end
257
257
 
258
258
  def initialize_global_settings(args = [])
259
- raise Puppet::DevError, "Attempting to initialize global default settings more than once!" if global_defaults_initialized?
259
+ raise Puppet::DevError, _("Attempting to initialize global default settings more than once!") if global_defaults_initialized?
260
260
 
261
261
  # The first two phases of the lifecycle of a puppet application are:
262
262
  # 1) Parse the command line options and handle any of them that are
@@ -686,7 +686,7 @@ class Puppet::Settings
686
686
 
687
687
  if type = hash[:type]
688
688
  unless klass = SETTING_TYPES[type]
689
- raise ArgumentError, "Invalid setting type '#{type}'"
689
+ raise ArgumentError, _("Invalid setting type '%{type}'") % { type: type }
690
690
  end
691
691
  hash.delete(:type)
692
692
  else
@@ -830,7 +830,7 @@ class Puppet::Settings
830
830
  when :environment
831
831
  ValuesFromEnvironmentConf.new(source.name)
832
832
  else
833
- raise(Puppet::DevError, "Unknown searchpath case: #{source.type} for the #{source} settings path element.")
833
+ raise Puppet::DevError, _("Unknown searchpath case: %{source_type} for the %{source} settings path element.") % { source_type: source.type, source: source}
834
834
  end
835
835
  end
836
836
 
@@ -892,16 +892,16 @@ class Puppet::Settings
892
892
  section = section.to_sym
893
893
  call = []
894
894
  defs.each do |name, hash|
895
- raise ArgumentError, "setting definition for '#{name}' is not a hash!" unless hash.is_a? Hash
895
+ raise ArgumentError, _("setting definition for '%{name}' is not a hash!") % { name: name } unless hash.is_a? Hash
896
896
 
897
897
  name = name.to_sym
898
898
  hash[:name] = name
899
899
  hash[:section] = section
900
- raise ArgumentError, "Setting #{name} is already defined" if @config.include?(name)
900
+ raise ArgumentError, _("Setting %{name} is already defined") % { name: name } if @config.include?(name)
901
901
  tryconfig = newsetting(hash)
902
902
  if short = tryconfig.short
903
903
  if other = @shortnames[short]
904
- raise ArgumentError, "Setting #{other.name} is already using short name '#{short}'"
904
+ raise ArgumentError, _("Setting %{name} is already using short name '%{short}'") % { name: other.name, short: short }
905
905
  end
906
906
  @shortnames[short] = tryconfig
907
907
  end
@@ -1158,9 +1158,14 @@ Generated on #{Time.now}.
1158
1158
  msg << " #{ref}" if ref
1159
1159
  Puppet.deprecation_warning(msg)
1160
1160
  when setting.completely_deprecated?
1161
- Puppet.deprecation_warning("Setting #{name} is deprecated. #{ref}", "setting-#{name}")
1161
+ message = _("Setting %{name} is deprecated.") % { name: name }
1162
+ message += " #{ref}"
1163
+ Puppet.deprecation_warning(message, "setting-#{name}")
1162
1164
  when setting.allowed_on_commandline?
1163
- Puppet.deprecation_warning("Setting #{name} is deprecated in puppet.conf. #{ref}", "puppet-conf-setting-#{name}")
1165
+ #TRANSLATORS 'puppet.conf' is a file name and should not be translated
1166
+ message = _("Setting %{name} is deprecated in puppet.conf.") % { name: name }
1167
+ message += " #{ref}"
1168
+ Puppet.deprecation_warning(message, "puppet-conf-setting-#{name}")
1164
1169
  end
1165
1170
  end
1166
1171
 
@@ -1304,7 +1309,7 @@ Generated on #{Time.now}.
1304
1309
  rescue InterpolationError => err
1305
1310
  # This happens because we don't have access to the param name when the
1306
1311
  # exception is originally raised, but we want it in the message
1307
- raise InterpolationError, "Error converting value for param '#{name}': #{err}", err.backtrace
1312
+ raise InterpolationError, _("Error converting value for param '%{name}': %{detail}") % { name: name, detail: err }, err.backtrace
1308
1313
  end
1309
1314
 
1310
1315
  setting.munge(val)
@@ -1333,7 +1338,7 @@ Generated on #{Time.now}.
1333
1338
  elsif !(pval = interpolate(varname.to_sym)).nil?
1334
1339
  pval
1335
1340
  else
1336
- raise InterpolationError, "Could not find value for #{expression}"
1341
+ raise InterpolationError, _("Could not find value for %{expression}") % { expression: expression }
1337
1342
  end
1338
1343
  else
1339
1344
  failed_environment_interpolation = true
@@ -1342,7 +1347,9 @@ Generated on #{Time.now}.
1342
1347
  interpolated_expression
1343
1348
  end
1344
1349
  if failed_environment_interpolation
1345
- Puppet.warning("You cannot interpolate $environment within '#{setting_name}' when using directory environments. Its value will remain #{interpolated_value}.")
1350
+ #TRANSLATORS '$environment' is a Puppet specific variable and should not be translated
1351
+ Puppet.warning(_("You cannot interpolate $environment within '%{setting_name}' when using directory environments.") % { setting_name: setting_name } +
1352
+ ' ' + _("Its value will remain %{value}.") % { value: interpolated_value })
1346
1353
  end
1347
1354
  interpolated_value
1348
1355
  else
@@ -1373,8 +1380,7 @@ Generated on #{Time.now}.
1373
1380
  default = @defaults[name]
1374
1381
 
1375
1382
  if !default
1376
- raise ArgumentError,
1377
- "Attempt to assign a value to unknown setting #{name.inspect}"
1383
+ raise ArgumentError, _("Attempt to assign a value to unknown setting %{name}") % { name: name.inspect }
1378
1384
  end
1379
1385
 
1380
1386
  # This little exception-handling dance ensures that a hook is
@@ -11,10 +11,14 @@ class Puppet::Settings::BaseSetting
11
11
 
12
12
  def call_hook=(value)
13
13
  if value.nil?
14
- Puppet.warning "Setting :#{name} :call_hook is nil, defaulting to :on_write_only"
14
+ #TRANSLATORS ':%{name}', ':call_hook', and ':on_write_only' should not be translated
15
+ Puppet.warning _("Setting :%{name} :call_hook is nil, defaulting to :on_write_only") % { name: name }
15
16
  value = :on_write_only
16
17
  end
17
- raise ArgumentError, "Invalid option #{value} for call_hook" unless self.class.available_call_hook_values.include? value
18
+ unless self.class.available_call_hook_values.include?(value)
19
+ #TRANSLATORS 'call_hook' is a Puppet option name and should not be translated
20
+ raise ArgumentError, _("Invalid option %{value} for call_hook") % { value: value }
21
+ end
18
22
  @call_hook = value
19
23
  end
20
24
 
@@ -67,16 +71,23 @@ class Puppet::Settings::BaseSetting
67
71
  @call_hook = :on_write_only if args[:hook] and not args[:call_hook]
68
72
  @has_hook = false
69
73
 
70
- raise ArgumentError, "Cannot reference :call_hook for :#{@name} if no :hook is defined" if args[:call_hook] and not args[:hook]
74
+ if args[:call_hook] and not args[:hook]
75
+ #TRANSLATORS ':call_hook' and ':hook' are specific setting names and should not be translated
76
+ raise ArgumentError, _("Cannot reference :call_hook for :%{name} if no :hook is defined") % { name: @name }
77
+ end
71
78
 
72
79
  args.each do |param, value|
73
80
  method = param.to_s + "="
74
- raise ArgumentError, "#{self.class} (setting '#{args[:name]}') does not accept #{param}" unless self.respond_to? method
81
+ unless self.respond_to? method
82
+ raise ArgumentError, _("%{class_name} (setting '%{setting}') does not accept %{parameter}") %
83
+ { class_name: self.class, setting: args[:name], parameter: param }
84
+ end
75
85
 
76
86
  self.send(method, value)
77
87
  end
78
-
79
- raise ArgumentError, "You must provide a description for the #{self.name} config option" unless self.desc
88
+ unless self.desc
89
+ raise ArgumentError, _("You must provide a description for the %{class_name} config option") % { class_name: self.name }
90
+ end
80
91
  end
81
92
 
82
93
  def iscreated
@@ -89,7 +100,7 @@ class Puppet::Settings::BaseSetting
89
100
 
90
101
  # short name for the celement
91
102
  def short=(value)
92
- raise ArgumentError, "Short names can only be one character." if value.to_s.length != 1
103
+ raise ArgumentError, _("Short names can only be one character.") if value.to_s.length != 1
93
104
  @short = value.to_s
94
105
  end
95
106
 
@@ -151,7 +162,11 @@ class Puppet::Settings::BaseSetting
151
162
  end
152
163
 
153
164
  def deprecated=(deprecation)
154
- raise(ArgumentError, "'#{deprecation}' is an unknown setting deprecation state. Must be either :completely or :allowed_on_commandline") unless [:completely, :allowed_on_commandline].include?(deprecation)
165
+ unless [:completely, :allowed_on_commandline].include?(deprecation)
166
+ #TRANSLATORS 'deprecated' is a Puppet setting and ':completely' and ':allowed_on_commandline' are possible values and should not be translated
167
+ raise ArgumentError, _("Unsupported deprecated value '%{deprecation}'.") % { deprecation: deprecation } +
168
+ ' ' + _("Supported values for deprecated are ':completely' or ':allowed_on_commandline'")
169
+ end
155
170
  @deprecated = deprecation
156
171
  end
157
172