puppet 5.3.3-x64-mingw32 → 5.3.4-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 (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
@@ -543,8 +543,8 @@ class HieraConfigV5 < HieraConfig
543
543
  tf = Types::TypeFactory
544
544
  nes_t = Types::PStringType::NON_EMPTY
545
545
 
546
- # Need alias here to avoid ridiculously long regexp burp in case of validation errors.
547
- uri_t = Pcore::TYPE_URI_ALIAS
546
+ # Validated using Ruby URI implementation
547
+ uri_t = Types::PStringType::NON_EMPTY
548
548
 
549
549
  # The option name must start with a letter and end with a letter or digit. May contain underscore and dash.
550
550
  option_name_t = tf.pattern(/\A[A-Za-z](:?[0-9A-Za-z_-]*[0-9A-Za-z])?\z/)
@@ -383,8 +383,8 @@ class LookupAdapter < DataAdapter
383
383
  mp
384
384
  else
385
385
  unless Puppet[:strict] == :off
386
- msg = _("Defining \"data_provider\": \"%{name}\" in metadata.json is deprecated") % { name: provider_name }
387
- msg += _(". A '%{config}' file should be used instead") % { config: HieraConfig::CONFIG_FILE_NAME } if mp.nil?
386
+ msg = _("Defining \"data_provider\": \"%{name}\" in metadata.json is deprecated.") % { name: provider_name }
387
+ msg += " " + _("A '%{hiera_config}' file should be used instead") % { hiera_config: HieraConfig::CONFIG_FILE_NAME } if mp.nil?
388
388
  Puppet.warn_once('deprecations', "metadata.json#data_provider-#{module_name}", msg, mod.metadata_file)
389
389
  end
390
390
 
@@ -437,8 +437,8 @@ class LookupAdapter < DataAdapter
437
437
  ep
438
438
  else
439
439
  unless Puppet[:strict] == :off
440
- msg = _("Defining environment_data_provider='%{provider_name}' in environment.conf is deprecated") % { provider_name: provider_name }
441
- msg += _(". A '%{config}' file should be used instead") % { config: HieraConfig::CONFIG_FILE_NAME } if ep.nil?
440
+ msg = _("Defining environment_data_provider='%{provider_name}' in environment.conf is deprecated.") % { provider_name: provider_name }
441
+ msg += " " + _("A '%{hiera_config}' file should be used instead") % { hiera_config: HieraConfig::CONFIG_FILE_NAME } if ep.nil?
442
442
  Puppet.warn_once('deprecations', 'environment.conf#data_provider', msg, env_path + 'environment.conf')
443
443
  end
444
444
 
@@ -24,7 +24,8 @@ module Puppet::Pops
24
24
  if merge.is_a?(Hash)
25
25
  merge_strategy = merge['strategy']
26
26
  if merge_strategy.nil?
27
- raise ArgumentError, "The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'"
27
+ #TRANSLATORS 'merge' is a variable name and 'strategy' is a key and should not be translated
28
+ raise ArgumentError, _("The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'")
28
29
  end
29
30
  merge_options = merge.size == 1 ? EMPTY_HASH : merge
30
31
  else
@@ -33,7 +34,7 @@ module Puppet::Pops
33
34
  end
34
35
  merge_strategy = merge_strategy.to_sym if merge_strategy.is_a?(String)
35
36
  strategy_class = strategies[merge_strategy]
36
- raise ArgumentError, "Unknown merge strategy: '#{merge_strategy}'" if strategy_class.nil?
37
+ raise ArgumentError, _("Unknown merge strategy: '%{strategy}'") % { strategy: merge_strategy } if strategy_class.nil?
37
38
  merge_options == EMPTY_HASH ? strategy_class::INSTANCE : strategy_class.new(merge_options)
38
39
  end
39
40
 
@@ -51,7 +52,9 @@ module Puppet::Pops
51
52
  #
52
53
  def self.add_strategy(strategy_class)
53
54
  unless MergeStrategy > strategy_class
54
- raise ArgumentError, "MergeStrategies.add_strategy 'strategy_class' must be a 'MergeStrategy' class. Got #{strategy_class}"
55
+ #TRANSLATORS 'MergeStrategies.add_strategy' is a method, 'stratgey_class' is a variable and 'MergeStrategy' is a class name and should not be translated
56
+ raise ArgumentError, _("MergeStrategies.add_strategy 'strategy_class' must be a 'MergeStrategy' class. Got %{strategy_class}") %
57
+ { strategy_class: strategy_class }
55
58
  end
56
59
  strategies[strategy_class.key] = strategy_class
57
60
  nil
@@ -18,41 +18,41 @@ class Puppet::Pops::Migration::MigrationChecker
18
18
 
19
19
  # For 3.8/4.0
20
20
  def report_ambiguous_integer(o)
21
- raise Puppet::DevError, "Unsupported migration method called"
21
+ raise Puppet::DevError, _("Unsupported migration method called")
22
22
  end
23
23
 
24
24
  # For 3.8/4.0
25
25
  def report_ambiguous_float(o)
26
- raise Puppet::DevError, "Unsupported migration method called"
26
+ raise Puppet::DevError, _("Unsupported migration method called")
27
27
  end
28
28
 
29
29
  # For 3.8/4.0
30
30
  def report_empty_string_true(value, o)
31
- raise Puppet::DevError, "Unsupported migration method called"
31
+ raise Puppet::DevError, _("Unsupported migration method called")
32
32
  end
33
33
 
34
34
  # For 3.8/4.0
35
35
  def report_uc_bareword_type(value, o)
36
- raise Puppet::DevError, "Unsupported migration method called"
36
+ raise Puppet::DevError, _("Unsupported migration method called")
37
37
  end
38
38
 
39
39
  # For 3.8/4.0
40
40
  def report_equality_type_mismatch(left, right, o)
41
- raise Puppet::DevError, "Unsupported migration method called"
41
+ raise Puppet::DevError, _("Unsupported migration method called")
42
42
  end
43
43
 
44
44
  # For 3.8/4.0
45
45
  def report_option_type_mismatch(test_value, option_value, option_expr, matching_expr)
46
- raise Puppet::DevError, "Unsupported migration method called"
46
+ raise Puppet::DevError, _("Unsupported migration method called")
47
47
  end
48
48
 
49
49
  # For 3.8/4.0
50
50
  def report_in_expression(o)
51
- raise Puppet::DevError, "Unsupported migration method called"
51
+ raise Puppet::DevError, _("Unsupported migration method called")
52
52
  end
53
53
 
54
54
  # For 3.8/4.0
55
55
  def report_array_last_in_block(o)
56
- raise Puppet::DevError, "Unsupported migration method called"
56
+ raise Puppet::DevError, _("Unsupported migration method called")
57
57
  end
58
58
  end
@@ -82,7 +82,7 @@ class Puppet::Pops::Model::AstTransformer
82
82
  # Ensures transformation fails if a 3.1 non supported object is encountered in a query expression
83
83
  #
84
84
  def query_Object(o)
85
- raise _("Not a valid expression in a collection query: ")+o.class.name
85
+ raise _("Not a valid expression in a collection query: %{class_name}") % { class_name: o.class.name }
86
86
  end
87
87
 
88
88
  # Transforms Array of host matching expressions into a (Ruby) array of AST::HostName
@@ -790,7 +790,9 @@ class Factory
790
790
  end
791
791
  else
792
792
  # Bad number should already have been caught by lexer - this should never happen
793
- raise ArgumentError, "Internal Error, NUMBER token does not contain a valid number, #{name_or_numeric}"
793
+ #TRANSLATORS 'NUMBER' refers to a method name and the 'name_or_numeric' was the passed in value and should not be translated
794
+ raise ArgumentError, _("Internal Error, NUMBER token does not contain a valid number, %{name_or_numeric}") %
795
+ { name_or_numeric: name_or_numeric }
794
796
  end
795
797
  end
796
798
 
@@ -1082,7 +1084,7 @@ class Factory
1082
1084
  elsif e.is_a?(String)
1083
1085
  result << e
1084
1086
  else
1085
- raise ArgumentError, "can only concatenate strings, got #{e.class}"
1087
+ raise ArgumentError, _("can only concatenate strings, got %{class_name}") % { class_name: e.class }
1086
1088
  end
1087
1089
  end
1088
1090
  infer(result)
@@ -164,7 +164,7 @@ class ResourceTypeImpl
164
164
  # the 'package' type where 'provider' attribute is handled as part of the key without being
165
165
  # set from the title.
166
166
  #
167
- raise Puppet::DevError,"you must specify title patterns when there are two or more key attributes"
167
+ raise Puppet::DevError, _("you must specify title patterns when there are two or more key attributes")
168
168
  end
169
169
  @title_patterns_hash.nil? ? [] : @title_patterns_hash.map { |k,v| [ k, v.map { |n| [ n.to_sym] } ] }
170
170
  end
@@ -99,7 +99,8 @@ class AbstractWriter
99
99
  #
100
100
  # @api private
101
101
  def write_tpl(ep, value)
102
- raise ArgumentError, 'Internal error. Integers cannot be tabulated in extension payload' if value.is_a?(Integer)
102
+ #TRANSLATORS 'Integers' is a Ruby class for numbers and should not be translated
103
+ raise ArgumentError, _('Internal error. Integers cannot be tabulated in extension payload') if value.is_a?(Integer)
103
104
  if @tabulate
104
105
  index = @written[value]
105
106
  if index.nil?
@@ -79,6 +79,8 @@ module Puppet::Pops::Types
79
79
  o.finite_range? ? IntegerRangeIterator.new(o) : nil
80
80
  when PEnumType
81
81
  Iterator.new(o, o.values.each)
82
+ when PTypeAliasType
83
+ on(o.resolved_type)
82
84
  when Range
83
85
  min = o.min
84
86
  max = o.max
@@ -132,7 +132,10 @@ class PObjectType < PMetaType
132
132
  def assert_override(parent_members)
133
133
  parent_member = parent_members[@name]
134
134
  if parent_member.nil?
135
- raise Puppet::ParseError, "expected #{label} to override an inherited #{feature_type}, but no such #{feature_type} was found" if @override
135
+ if @override
136
+ raise Puppet::ParseError, _("expected %{label} to override an inherited %{feature_type}, but no such %{feature_type} was found") %
137
+ { label: label, feature_type: feature_type }
138
+ end
136
139
  self
137
140
  else
138
141
  parent_member.assert_can_be_overridden(self)
@@ -146,10 +149,19 @@ class PObjectType < PMetaType
146
149
  # @raises [Puppet::ParseError] if the assertion fails
147
150
  # @api private
148
151
  def assert_can_be_overridden(member)
149
- raise Puppet::ParseError, "#{member.label} attempts to override #{label}" unless self.class == member.class
150
- raise Puppet::ParseError, "#{member.label} attempts to override final #{label}" if @final && !(constant? && member.constant?)
151
- raise Puppet::ParseError, "#{member.label} attempts to override #{label} without having override => true" unless member.override?
152
- raise Puppet::ParseError, "#{member.label} attempts to override #{label} with a type that does not match" unless @type.assignable?(member.type)
152
+ unless self.class == member.class
153
+ raise Puppet::ParseError, _("%{member} attempts to override %{label}") % { member: member.label, label: label }
154
+ end
155
+ if @final && !(constant? && member.constant?)
156
+ raise Puppet::ParseError, _("%{member} attempts to override final %{label}") % { member: member.label, label: label }
157
+ end
158
+ unless member.override?
159
+ #TRANSLATOR 'override => true' is a puppet syntax and should not be translated
160
+ raise Puppet::ParseError, _("%{member} attempts to override %{label} without having override => true") % { member: member.label, label: label }
161
+ end
162
+ unless @type.assignable?(member.type)
163
+ raise Puppet::ParseError, _("%{member} attempts to override %{label} with a type that does not match") % { member: member.label, label: label }
164
+ end
153
165
  member
154
166
  end
155
167
 
@@ -264,19 +276,20 @@ class PObjectType < PMetaType
264
276
  @kind = init_hash[KEY_KIND]
265
277
  if @kind == ATTRIBUTE_KIND_CONSTANT # final is implied
266
278
  if init_hash.include?(KEY_FINAL) && !@final
267
- raise Puppet::ParseError, "#{label} of kind 'constant' cannot be combined with final => false"
279
+ #TRANSLATOR 'final => false' is puppet syntax and should not be translated
280
+ raise Puppet::ParseError, _("%{label} of kind 'constant' cannot be combined with final => false") % { label: label }
268
281
  end
269
282
  @final = true
270
283
  end
271
284
 
272
285
  if init_hash.include?(KEY_VALUE)
273
286
  if @kind == ATTRIBUTE_KIND_DERIVED || @kind == ATTRIBUTE_KIND_GIVEN_OR_DERIVED
274
- raise Puppet::ParseError, "#{label} of kind '#{@kind}' cannot be combined with an attribute value"
287
+ raise Puppet::ParseError, _("%{label} of kind '%{kind}' cannot be combined with an attribute value") % { label: label, kind: @kind }
275
288
  end
276
289
  v = init_hash[KEY_VALUE]
277
290
  @value = v == :default ? v : TypeAsserter.assert_instance_of(nil, type, v) {"#{label} #{KEY_VALUE}" }
278
291
  else
279
- raise Puppet::ParseError, "#{label} of kind 'constant' requires a value" if @kind == ATTRIBUTE_KIND_CONSTANT
292
+ raise Puppet::ParseError, _("%{label} of kind 'constant' requires a value") % { label: label } if @kind == ATTRIBUTE_KIND_CONSTANT
280
293
  @value = :undef # Not to be confused with nil or :default
281
294
  end
282
295
  end
@@ -618,7 +631,9 @@ class PObjectType < PMetaType
618
631
  attr_specs = init_hash[KEY_ATTRIBUTES] || {}
619
632
  unless constants.nil? || constants.empty?
620
633
  constants.each do |key, value|
621
- raise Puppet::ParseError, "attribute #{label}[#{key}] is defined as both a constant and an attribute" if attr_specs.include?(key)
634
+ if attr_specs.include?(key)
635
+ raise Puppet::ParseError, _("attribute %{label}[%{key}] is defined as both a constant and an attribute") % { label: label, key: key }
636
+ end
622
637
  attr_spec = {
623
638
  # Type must be generic here, or overrides would become impossible
624
639
  KEY_TYPE => TypeCalculator.infer(value).generalize,
@@ -649,7 +664,7 @@ class PObjectType < PMetaType
649
664
  func_spec = { KEY_TYPE => TypeAsserter.assert_instance_of(nil, TYPE_FUNCTION_TYPE, func_spec) { "function #{label}[#{key}]" } } unless func_spec.is_a?(Hash)
650
665
  func = PFunction.new(key, self, func_spec)
651
666
  name = func.name
652
- raise Puppet::ParseError, "#{func.label} conflicts with attribute with the same name" if @attributes.include?(name)
667
+ raise Puppet::ParseError, _("%{label} conflicts with attribute with the same name") % { label: func.label } if @attributes.include?(name)
653
668
  [name, func.assert_override(parent_members)]
654
669
  end].freeze
655
670
  end
@@ -661,7 +676,8 @@ class PObjectType < PMetaType
661
676
  equality = [equality] if equality.is_a?(String)
662
677
  if equality.is_a?(Array)
663
678
  unless equality.empty?
664
- raise Puppet::ParseError, 'equality_include_type = false cannot be combined with non empty equality specification' unless @equality_include_type
679
+ #TRANSLATORS equality_include_type = false should not be translated
680
+ raise Puppet::ParseError, _('equality_include_type = false cannot be combined with non empty equality specification') unless @equality_include_type
665
681
  parent_eq_attrs = nil
666
682
  equality.each do |attr_name|
667
683
 
@@ -673,16 +689,21 @@ class PObjectType < PMetaType
673
689
  parent_eq_attrs ||= parent_object_type.equality_attributes
674
690
  if parent_eq_attrs.include?(attr_name)
675
691
  including_parent = find_equality_definer_of(attr)
676
- raise Puppet::ParseError, "#{label} equality is referencing #{attr.label} which is included in equality of #{including_parent.label}"
692
+ raise Puppet::ParseError, _("%{label} equality is referencing %{attribute} which is included in equality of %{including_parent}") %
693
+ { label: label, attribute: attr.label, including_parent: including_parent.label }
677
694
  end
678
695
  end
679
696
 
680
697
  unless attr.is_a?(PAttribute)
681
- raise Puppet::ParseError, "#{label} equality is referencing non existent attribute '#{attr_name}'" if attr.nil?
682
- raise Puppet::ParseError, "#{label} equality is referencing #{attr.label}. Only attribute references are allowed"
698
+ if attr.nil?
699
+ raise Puppet::ParseError, _("%{label} equality is referencing non existent attribute '%{attribute}'") % { label: label, attribute: attr_name }
700
+ end
701
+ raise Puppet::ParseError, _("%{label} equality is referencing %{attribute}. Only attribute references are allowed") %
702
+ { label: label, attribute: attr.label }
683
703
  end
684
704
  if attr.kind == ATTRIBUTE_KIND_CONSTANT
685
- raise Puppet::ParseError, "#{label} equality is referencing constant #{attr.label}. Reference to constant is not allowed in equality"
705
+ raise Puppet::ParseError, _("%{label} equality is referencing constant %{attribute}.") % { label: label, attribute: attr.label } + ' ' +
706
+ _("Reference to constant is not allowed in equality")
686
707
  end
687
708
  end
688
709
  end
@@ -163,7 +163,8 @@ class TypeCalculator
163
163
 
164
164
  # Returns an iterable if the t represents something that can be iterated
165
165
  def enumerable(t)
166
- Puppet.deprecation_warning('TypeCalculator.enumerable is deprecated. Use iterable')
166
+ #TRANSLATOR 'TypeCalculator.enumerable' and 'iterable' are methods and should not be translated
167
+ Puppet.deprecation_warning(_('TypeCalculator.enumerable is deprecated. Use iterable'))
167
168
  iterable(t)
168
169
  end
169
170
 
@@ -100,7 +100,9 @@ module TypeFactory
100
100
  size_type_or_value.nil? ? PStringType::DEFAULT : PStringType.new(size_type_or_value)
101
101
  else
102
102
  if Puppet[:strict] != :off
103
- Puppet.warn_once('deprecations', "TypeFactory#string_multi_args", "Passing more than one argument to TypeFactory#string is deprecated")
103
+ #TRANSLATORS 'TypeFactory#string' is a class and method name and should not be translated
104
+ message = _("Passing more than one argument to TypeFactory#string is deprecated")
105
+ Puppet.warn_once('deprecations', "TypeFactory#string_multi_args", message)
104
106
  end
105
107
  deprecated_second_argument.size == 1 ? PStringType.new(deprecated_second_argument[0]) : PEnumType.new(*deprecated_second_argument)
106
108
  end
@@ -286,8 +286,8 @@ module Types
286
286
  a = detailed_actual_to_s(e, a)
287
287
  e = e.map { |t| t.to_alias_expanded_s }
288
288
  else
289
- e = e.map { |t| t.simple_name }.uniq
290
- a = a.simple_name
289
+ e = e.map { |t| short_name(t) }.uniq
290
+ a = short_name(a)
291
291
  end
292
292
  e.insert(0, 'Undef') if optional
293
293
  case e.size
@@ -305,8 +305,8 @@ module Types
305
305
  a = detailed_actual_to_s(e, a)
306
306
  e = e.to_alias_expanded_s
307
307
  else
308
- e = e.simple_name
309
- a = a.simple_name
308
+ e = short_name(e)
309
+ a = short_name(a)
310
310
  end
311
311
  if optional
312
312
  e = "Undef or #{e}"
@@ -326,6 +326,16 @@ module Types
326
326
 
327
327
  private
328
328
 
329
+ def short_name(t)
330
+ # Ensure that Optional, NotUndef, Sensitive, and Type are reported with included
331
+ # type parameter.
332
+ if t.is_a?(PTypeWithContainedType) && !(t.type.nil? || t.type.class == PAnyType)
333
+ "#{t.name}[#{t.type.name}]"
334
+ else
335
+ t.name.nil? ? t.simple_name : t.name
336
+ end
337
+ end
338
+
329
339
  # Answers the question if `e` is a specialized type of `a`
330
340
  # @param e [PAnyType] the expected type
331
341
  # @param a [PAnyType] the actual type
@@ -430,7 +440,7 @@ module Types
430
440
 
431
441
  def actual_string
432
442
  a = actual
433
- a.is_a?(PStringType) && !a.value.nil? ? "'#{a.value}'" : a.simple_name
443
+ a.is_a?(PStringType) && !a.value.nil? ? "'#{a.value}'" : short_name(a)
434
444
  end
435
445
  end
436
446
 
@@ -502,7 +512,10 @@ module Types
502
512
  end
503
513
 
504
514
  def tense_deprecated
505
- Puppet.warn_once('deprecations', 'typemismatch#tense', "Passing a 'tense' argument to the TypeMismatchDescriber is deprecated and ignored. Everything is now reported using present tense")
515
+ #TRANSLATORS TypeMismatchDescriber is a class name and 'tense' is a method name and should not be translated
516
+ message = _("Passing a 'tense' argument to the TypeMismatchDescriber is deprecated and ignored.")
517
+ message += ' ' + _("Everything is now reported using present tense")
518
+ Puppet.warn_once('deprecations', 'typemismatch#tense', message)
506
519
  end
507
520
 
508
521
  # Validates that all entries in the give_hash exists in the given param_struct, that their type conforms
@@ -342,7 +342,7 @@ class TypeParser
342
342
  when 'enum'
343
343
  # 1..m parameters being strings
344
344
  raise_invalid_parameters_error('Enum', '1 or more', parameters.size) unless parameters.size >= 1
345
- parameters.each { |p| raise Puppet::ParseError, 'Enum parameters must be identifiers or strings' unless p.is_a?(String) }
345
+ parameters.each { |p| raise Puppet::ParseError, _('Enum parameters must be identifiers or strings') unless p.is_a?(String) }
346
346
  TypeFactory.enum(*parameters)
347
347
 
348
348
  when 'pattern'
@@ -565,21 +565,21 @@ class TypeParser
565
565
  end
566
566
 
567
567
  def raise_invalid_type_specification_error(ast)
568
- raise Puppet::ParseError,
569
- "The expression <#{original_text_of(ast)}> is not a valid type specification."
568
+ raise Puppet::ParseError, _("The expression <%{expression}> is not a valid type specification.") %
569
+ { expression: original_text_of(ast) }
570
570
  end
571
571
 
572
572
  def raise_invalid_parameters_error(type, required, given)
573
- raise Puppet::ParseError,
574
- "Invalid number of type parameters specified: #{type} requires #{required}, #{given} provided"
573
+ raise Puppet::ParseError, _("Invalid number of type parameters specified: %{type} requires %{required}, %{given} provided") %
574
+ { type: type, required: required, given: given }
575
575
  end
576
576
 
577
577
  def raise_unparameterized_type_error(ast)
578
- raise Puppet::ParseError, "Not a parameterized type <#{original_text_of(ast)}>"
578
+ raise Puppet::ParseError, _("Not a parameterized type <%{type}>") % { type: original_text_of(ast) }
579
579
  end
580
580
 
581
581
  def raise_unknown_type_error(ast)
582
- raise Puppet::ParseError, "Unknown type <#{original_text_of(ast)}>"
582
+ raise Puppet::ParseError, _("Unknown type <%{type}>") % { type: original_text_of(ast) }
583
583
  end
584
584
 
585
585
  def original_text_of(ast)
@@ -939,7 +939,7 @@ class PNumericType < PScalarDataType
939
939
  end
940
940
 
941
941
  def instance?(o, guard = nil)
942
- o.is_a?(Numeric) && o >= @from && o <= @to
942
+ (o.is_a?(Float) || o.is_a?(Integer)) && o >= @from && o <= @to
943
943
  end
944
944
 
945
945
  def unbounded?
@@ -1341,6 +1341,8 @@ class PIterableType < PTypeWithContainedType
1341
1341
  o >= 0
1342
1342
  when PIntegerType
1343
1343
  o.finite_range?
1344
+ when PTypeAliasType
1345
+ instance?(o.resolved_type, guard)
1344
1346
  else
1345
1347
  false
1346
1348
  end
@@ -1427,7 +1429,9 @@ class PStringType < PScalarDataType
1427
1429
  def initialize(size_type_or_value, deprecated_multi_args = EMPTY_ARRAY)
1428
1430
  unless deprecated_multi_args.empty?
1429
1431
  if Puppet[:strict] != :off
1430
- Puppet.warn_once('deprecations', "PStringType#initialize_multi_args", "Passing more than one argument to PStringType#initialize is deprecated")
1432
+ #TRANSLATORS 'PStringType#initialize' is a class and method name and should not be translated
1433
+ Puppet.warn_once('deprecations', "PStringType#initialize_multi_args",
1434
+ _("Passing more than one argument to PStringType#initialize is deprecated"))
1431
1435
  end
1432
1436
  size_type_or_value = deprecated_multi_args[0]
1433
1437
  end
@@ -1480,7 +1484,8 @@ class PStringType < PScalarDataType
1480
1484
  # @api private
1481
1485
  def values
1482
1486
  if Puppet[:strict] != :off
1483
- Puppet.warn_once('deprecations', "PStringType#values", "Method PStringType#values is deprecated. Use #value instead")
1487
+ #TRANSLATORS 'PStringType#values' and '#value' are classes and method names and should not be translated
1488
+ Puppet.warn_once('deprecations', "PStringType#values", _("Method PStringType#values is deprecated. Use #value instead"))
1484
1489
  end
1485
1490
  @value.is_a?(String) ? [@value] : EMPTY_ARRAY
1486
1491
  end
@@ -2599,8 +2604,9 @@ class PHashType < PCollectionType
2599
2604
 
2600
2605
  def element_type
2601
2606
  if Puppet[:strict] != :off
2607
+ #TRANSLATOR 'Puppet::Pops::Types::PHashType#element_type' and '#value_type' are class and method names and should not be translated
2602
2608
  Puppet.warn_once('deprecations', 'Puppet::Pops::Types::PHashType#element_type',
2603
- 'Puppet::Pops::Types::PHashType#element_type is deprecated, use #value_type instead')
2609
+ _('Puppet::Pops::Types::PHashType#element_type is deprecated, use #value_type instead'))
2604
2610
  end
2605
2611
  @value_type
2606
2612
  end