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
@@ -143,7 +143,7 @@ class Puppet::Provider
143
143
  elsif superclass.respond_to? :command and command = superclass.command(name)
144
144
  # nothing
145
145
  else
146
- raise Puppet::DevError, "No command #{name} defined for provider #{self.name}"
146
+ raise Puppet::DevError, _("No command %{command} defined for provider %{provider}") % { command: name, provider: self.name }
147
147
  end
148
148
 
149
149
  which(command)
@@ -374,7 +374,7 @@ class Puppet::Provider
374
374
  # @raise [Puppet::DevError] Error indicating that the method should have been implemented by subclass.
375
375
  # @see prefetch
376
376
  def self.instances
377
- raise Puppet::DevError, "Provider #{self.name} has not defined the 'instances' class method"
377
+ raise Puppet::DevError, _("Provider %{provider} has not defined the 'instances' class method") % { provider: self.name }
378
378
  end
379
379
 
380
380
  # Creates getter- and setter- methods for each property supported by the resource type.
@@ -446,7 +446,7 @@ class Puppet::Provider
446
446
  klass = param
447
447
  else
448
448
  unless klass = resource_type.attrclass(param)
449
- raise Puppet::DevError, "'#{param}' is not a valid parameter for #{resource_type.name}"
449
+ raise Puppet::DevError, _("'%{parameter_name}' is not a valid parameter for %{resource_type}") % { parameter_name: param, resource_type: resource_type.name }
450
450
  end
451
451
  end
452
452
  return true unless features = klass.required_features
@@ -530,7 +530,7 @@ class Puppet::Provider
530
530
  elsif self.resource
531
531
  resource.name
532
532
  else
533
- raise Puppet::DevError, "No resource and no name in property hash in #{self.class.name} instance"
533
+ raise Puppet::DevError, _("No resource and no name in property hash in %{class_name} instance") % { class_name: self.class.name }
534
534
  end
535
535
  end
536
536
 
@@ -98,8 +98,10 @@ Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject d
98
98
  def get_arguments(key, value, mapping, objectinfo)
99
99
  # In the case of attributes, return a list of key=value
100
100
  if key == :attributes
101
- raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{resource}[%{name}]") % { resource: @resource.class.name, name: @resource.name } \
102
- unless value and value.is_a? Hash
101
+ unless value and value.is_a? Hash
102
+ raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{resource}[%{name}]") %
103
+ { resource: @resource.class.name, name: @resource.name }
104
+ end
103
105
  return value.select { |k,v| true }.map { |pair| pair.join("=") }
104
106
  end
105
107
  super(key, value, mapping, objectinfo)
@@ -74,8 +74,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
74
74
  end
75
75
 
76
76
  def initialize(*args)
77
- raise(Puppet::DevError, "No LDAP Configuration defined for #{self.class}") unless self.class.manager
78
- raise(Puppet::DevError, "Invalid LDAP Configuration defined for #{self.class}") unless self.class.manager.valid?
77
+ raise(Puppet::DevError, _("No LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager
78
+ raise(Puppet::DevError, _("Invalid LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager.valid?
79
79
  super
80
80
 
81
81
  @property_hash = @property_hash.inject({}) do |result, ary|
@@ -10,7 +10,7 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
10
10
  unless @nagios_type
11
11
  name = resource_type.name.to_s.sub(/^nagios_/, '')
12
12
  unless @nagios_type = Nagios::Base.type(name.to_sym)
13
- raise Puppet::DevError, "Could not find nagios type '#{name}'"
13
+ raise Puppet::DevError, _("Could not find nagios type '%{name}'") % { name: name }
14
14
  end
15
15
 
16
16
  # And add our 'ensure' settings, since they aren't a part of
@@ -41,7 +41,9 @@ class Puppet::Provider::NameService < Puppet::Provider
41
41
  end
42
42
 
43
43
  def options(name, hash)
44
- raise Puppet::DevError, "#{name} is not a valid attribute for #{resource_type.name}" unless resource_type.valid_parameter?(name)
44
+ unless resource_type.valid_parameter?(name)
45
+ raise Puppet::DevError, _("%{name} is not a valid attribute for %{resource_type}") % { name: name, resource_type: resource_type.name }
46
+ end
45
47
  @options ||= {}
46
48
  @options[name] ||= {}
47
49
 
@@ -115,7 +117,7 @@ class Puppet::Provider::NameService < Puppet::Provider
115
117
  end
116
118
 
117
119
  # Autogenerate a value. Mostly used for uid/gid, but also used heavily
118
- # with DirectoryServices, because DirectoryServices is stupid.
120
+ # with DirectoryServices
119
121
  def autogen(field)
120
122
  field = field.intern
121
123
  id_generators = {:user => :uid, :group => :gid}
@@ -141,7 +143,8 @@ class Puppet::Provider::NameService < Puppet::Provider
141
143
  when :user; database = :passwd; method = :uid
142
144
  when :group; database = :group; method = :gid
143
145
  else
144
- raise Puppet::DevError, "Invalid resource name #{resource}"
146
+ #TRANSLATORS "autogen_id()" is a method name and should not be translated
147
+ raise Puppet::DevError, _("autogen_id() does not support auto generation of id for resource type %{resource_type}") % { resource_type: resource_type }
145
148
  end
146
149
 
147
150
  # Initialize from the data set, if needed.
@@ -291,7 +294,7 @@ class Puppet::Provider::NameService < Puppet::Provider
291
294
  def set(param, value)
292
295
  self.class.validate(param, value)
293
296
  cmd = modifycmd(param, munge(param, value))
294
- raise Puppet::DevError, "Nameservice command must be an array" unless cmd.is_a?(Array)
297
+ raise Puppet::DevError, _("Nameservice command must be an array") unless cmd.is_a?(Array)
295
298
  begin
296
299
  execute(cmd)
297
300
  rescue Puppet::ExecutionFailure => detail
@@ -196,8 +196,9 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
196
196
  # zeroes. If someone attempts to use a password hash that worked with
197
197
  # a previous version of OS X, we will fail early and warn them.
198
198
  if password_hash.length != 136
199
- fail(_("OS X 10.7 requires a Salted SHA512 hash password of 136 characters. \
200
- Please check your password and try again."))
199
+ #TRANSLATORS 'OS X 10.7' is an operating system and should not be translated, 'Salted SHA512' is the name of a hashing algorithm
200
+ fail(_("OS X 10.7 requires a Salted SHA512 hash password of 136 characters.") +
201
+ ' ' + _("Please check your password and try again."))
201
202
  end
202
203
 
203
204
  plist_file = "#{users_plist_dir}/#{resource_name}.plist"
@@ -372,7 +373,7 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
372
373
  # expects to be returned by addcmd. Thus we don't bother defining addcmd.
373
374
  def create
374
375
  if exists?
375
- info "already exists"
376
+ info _("already exists")
376
377
  return nil
377
378
  end
378
379
 
@@ -136,7 +136,7 @@ Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package d
136
136
  unless upd.nil?
137
137
  return "#{upd[:version]}"
138
138
  else
139
- raise Puppet::DevError, "Tried to get latest on a missing package" if properties[:ensure] == :absent
139
+ raise Puppet::DevError, _("Tried to get latest on a missing package") if properties[:ensure] == :absent
140
140
 
141
141
  return properties[:ensure]
142
142
  end
@@ -97,14 +97,13 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
97
97
  end
98
98
 
99
99
  if (package_type == nil)
100
- #TRANSLATORS Full message: "Unable to find package #{pkg} with version #{version} on lpp_source #{source}"
101
- errmsg = _("Unable to find package '%{pkg}' ") % { pkg: pkg }
102
- if (version_specified)
103
- #TRANSLATORS Full message: "Unable to find package #{pkg} with version #{version} on lpp_source #{source}"
104
- errmsg << _("with version '%{version}' ") % { version: version }
105
- end
106
- #TRANSLATORS Full message: "Unable to find package #{pkg} with version #{version} on lpp_source #{source}"
107
- errmsg << "on lpp_source '#{source}'"
100
+
101
+ errmsg = if version_specified
102
+ _("Unable to find package '%{package}' with version '%{version}' on lpp_source '%{source}'") %
103
+ { package: pkg, version: version, source: source }
104
+ else
105
+ _("Unable to find package '%{package}' on lpp_source '%{source}'") % { package: pkg, source: source }
106
+ end
108
107
  self.fail errmsg
109
108
  end
110
109
 
@@ -22,7 +22,7 @@ Puppet::Type.type(:package).provide :opkg, :source => :opkg, :parent => Puppet::
22
22
  packages << new(hash)
23
23
  hash = {}
24
24
  else
25
- warning(_("Failed to match line %s" % line))
25
+ warning(_("Failed to match line %{line}") % { line: line })
26
26
  end
27
27
  }
28
28
  end
@@ -43,7 +43,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
43
43
  when '-'
44
44
  {:status => 'known'}
45
45
  else
46
- raise ArgumentError, _('Unknown format %s: %s[%s]') % [self.name, flags, flags[0..0]]
46
+ raise ArgumentError, _('Unknown format %{resource_name}: %{full_flags}[%{bad_flag}]') %
47
+ { resource_name: self.name, full_flags: flags, bad_flag: flags[0..0] }
47
48
  end
48
49
  ).merge(
49
50
  case flags[1..1]
@@ -52,7 +53,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
52
53
  when '-'
53
54
  {}
54
55
  else
55
- raise ArgumentError, _('Unknown format %s: %s[%s]') % [self.name, flags, flags[1..1]]
56
+ raise ArgumentError, _('Unknown format %{resource_name}: %{full_flags}[%{bad_flag}]') %
57
+ { resource_name: self.name, full_flags: flags, bad_flag: flags[1..1] }
56
58
  end
57
59
  )
58
60
  end
@@ -82,7 +84,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
82
84
  when /known/
83
85
  {:status => 'known'}
84
86
  else
85
- raise ArgumentError, _('Unknown format %s: %s') % [self.name, state]
87
+ raise ArgumentError, _('Unknown format %{resource_name}: %{state}') % { resource_name: self.name, state: state }
86
88
  end
87
89
  end
88
90
 
@@ -101,7 +103,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
101
103
  {:publisher => $1, :name => $2, :ensure => $3}.merge pkg_state($4).merge(ufoxi_flag($5))
102
104
 
103
105
  else
104
- raise ArgumentError, _('Unknown line format %s: %s') % [self.name, line]
106
+ raise ArgumentError, _('Unknown line format %{resource_name}: %{parse_line}') % { resource_name: self.name, parse_line: line }
105
107
  end).merge({:provider => self.name})
106
108
  end
107
109
 
@@ -161,7 +163,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
161
163
  return false
162
164
  end
163
165
  }
164
- raise Puppet::DevError, "No version of #{name} matching #{should} is installable, even though the package is currently installed"
166
+ raise Puppet::DevError, _("No version of %{name} matching %{should} is installable, even though the package is currently installed") %
167
+ { name: name, should: should }
165
168
  end
166
169
 
167
170
  false
@@ -176,7 +179,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
176
179
  # remove certificate expiration warnings from the output, but report them
177
180
  cert_warnings = lines.select { |line| line =~ /^Certificate/ }
178
181
  unless cert_warnings.empty?
179
- Puppet.warning("pkg warning: #{cert_warnings.join(', ')}")
182
+ Puppet.warning(_("pkg warning: %{warnings}") % { warnings: cert_warnings.join(', ') })
180
183
  end
181
184
 
182
185
  lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }
@@ -70,7 +70,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
70
70
  if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
71
71
  { :alias => $1, :name => $2, :avail => $3 }
72
72
  else
73
- Puppet.warning _("Cannot match %s") % line
73
+ Puppet.warning _("Cannot match %{line}") % { line: line }
74
74
  end
75
75
  end.reject { |h| h.nil? }
76
76
  end
@@ -88,7 +88,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
88
88
  output = output.split("\n")
89
89
 
90
90
  if output[-1] == "Not in catalog"
91
- Puppet.warning _("Package not in pkgutil catalog: %s") % hash[:justme]
91
+ Puppet.warning _("Package not in pkgutil catalog: %{package}") % { package: hash[:justme] }
92
92
  return nil
93
93
  end
94
94
 
@@ -142,7 +142,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
142
142
 
143
143
  return hash
144
144
  else
145
- Puppet.warning _("Cannot match %s") % line
145
+ Puppet.warning _("Cannot match %{line}") % { line: line }
146
146
  return nil
147
147
  end
148
148
  end
@@ -230,7 +230,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
230
230
  else
231
231
  # Yum didn't find updates, pretend the current version is the latest
232
232
  version = properties[:ensure]
233
- raise Puppet::DevError, "Tried to get latest on a missing package" if version == :absent || version == :purged
233
+ raise Puppet::DevError, _("Tried to get latest on a missing package") if version == :absent || version == :purged
234
234
  return version
235
235
  end
236
236
  end
@@ -43,7 +43,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
43
43
  elsif klass = Puppet::Util::FileType.filetype(type)
44
44
  @filetype = klass
45
45
  else
46
- raise ArgumentError, "Invalid filetype #{type}"
46
+ raise ArgumentError, _("Invalid filetype %{type}") % { type: type }
47
47
  end
48
48
  end
49
49
 
@@ -277,7 +277,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
277
277
 
278
278
  target_records = prefetch_hook(target_records) if respond_to?(:prefetch_hook)
279
279
 
280
- raise Puppet::DevError, "Prefetching #{target} for provider #{self.name} returned nil" unless target_records
280
+ raise Puppet::DevError, _("Prefetching %{target} for provider %{name} returned nil") % { target: target, name: self.name } unless target_records
281
281
 
282
282
  target_records
283
283
  end
@@ -350,7 +350,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
350
350
  def self.targets(resources = nil)
351
351
  targets = []
352
352
  # First get the default target
353
- raise Puppet::DevError, "Parsed Providers must define a default target" unless self.default_target
353
+ raise Puppet::DevError, _("Parsed Providers must define a default target") unless self.default_target
354
354
  targets << self.default_target
355
355
 
356
356
  # Then get each of the file objects
@@ -439,7 +439,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
439
439
 
440
440
  # Retrieve the current state from disk.
441
441
  def prefetch
442
- raise Puppet::DevError, "Somehow got told to prefetch with no resource set" unless @resource
442
+ raise Puppet::DevError, _("Somehow got told to prefetch with no resource set") unless @resource
443
443
  self.class.prefetch(@resource[:name] => @resource)
444
444
  end
445
445
 
@@ -118,11 +118,13 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
118
118
  end
119
119
 
120
120
  def selmodversion_loaded
121
- lines = ()
121
+ selmod_output = []
122
+ selmodule_cmd = "#{command(:semodule)} --list"
122
123
  begin
123
- execpipe("#{command(:semodule)} --list") do |output|
124
+ execpipe(selmodule_cmd) do |output|
124
125
  output.each_line do |line|
125
126
  line.chomp!
127
+ selmod_output << line
126
128
  bits = line.split
127
129
  if bits[0] == @resource[:name]
128
130
  self.debug "load version #{bits[1]}"
@@ -131,7 +133,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
131
133
  end
132
134
  end
133
135
  rescue Puppet::ExecutionFailure
134
- raise Puppet::ExecutionFailure, "Could not list policy modules: #{lines.join(' ').chomp!}", $!.backtrace
136
+ raise Puppet::ExecutionFailure, _("Could not list policy modules: \"%{selmodule_command}\" failed with \"%{selmod_output}\"") % { selmodule_command: selmodule_cmd, selmod_output: selmod_output.join(' ') }
135
137
  end
136
138
  nil
137
139
  end
@@ -115,7 +115,7 @@ Puppet::Type.type(:service).provide :base, :parent => :service do
115
115
  else
116
116
  pid = getpid
117
117
  unless pid
118
- self.info "#{self.name} is not running"
118
+ self.info _("%{name} is not running") % { name: self.name }
119
119
  return false
120
120
  end
121
121
  begin
@@ -171,7 +171,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
171
171
 
172
172
  def texecute(type, command, fof = true, squelch = false, combine = true)
173
173
  if type == :start && Facter.value(:osfamily) == "Solaris"
174
- command = ["/usr/bin/ctrun -l none", command].flatten.join(" ")
174
+ command = ["/usr/bin/ctrun -l child", command].flatten.join(" ")
175
175
  end
176
176
  super(type, command, fof, squelch, combine)
177
177
  end
@@ -141,8 +141,8 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
141
141
  if job.has_key?("Label")
142
142
  @label_to_path_map[job["Label"]] = filepath
143
143
  else
144
- Puppet.warning("The #{filepath} plist does not contain a 'label' key; " +
145
- "Puppet is skipping it")
144
+ #TRANSLATORS 'plist' and label' should not be translated
145
+ Puppet.warning(_("The %{file} plist does not contain a 'label' key; Puppet is skipping it") % { file: filepath })
146
146
  next
147
147
  end
148
148
  end
@@ -89,7 +89,8 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
89
89
  # Work around issue #4480
90
90
  # runsvdir takes up to 5 seconds to recognize
91
91
  # the symlink created by this call to enable
92
- Puppet.info "Waiting 5 seconds for runsvdir to discover service #{self.service}"
92
+ #TRANSLATORS 'runsvdir' is a linux service name and should not be translated
93
+ Puppet.info _("Waiting 5 seconds for runsvdir to discover service %{service}") % { service: self.service }
93
94
  sleep 5
94
95
  end
95
96
  sv "start", self.service
@@ -107,6 +107,8 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
107
107
  end
108
108
 
109
109
  def stop
110
+ # Don't try to stop non-existing services (PUP-8167)
111
+ return if self.status == :absent
110
112
  # Wait for the service to actually stop before returning.
111
113
  super
112
114
  self.wait('offline', 'disabled', 'uninitialized')
@@ -23,6 +23,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
23
23
  defaultfor :osfamily => :redhat, :operatingsystem => :fedora
24
24
  defaultfor :osfamily => :suse
25
25
  defaultfor :osfamily => :coreos
26
+ defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"]
26
27
  defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["8", "stretch/sid", "9", "buster/sid"]
27
28
  defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["15.04","15.10","16.04","16.10"]
28
29
  defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ["3"]
@@ -12,7 +12,7 @@ Puppet::Type.type(:service).provide :upstart, :parent => :debian do
12
12
  confine :any => [
13
13
  Facter.value(:operatingsystem) == 'Ubuntu',
14
14
  (Facter.value(:osfamily) == 'RedHat' and Facter.value(:operatingsystemrelease) =~ /^6\./),
15
- Facter.value(:operatingsystem) == 'Amazon',
15
+ (Facter.value(:operatingsystem) == 'Amazon' and Facter.value(:operatingsystemmajrelease) =~ /\d{4}/),
16
16
  Facter.value(:operatingsystem) == 'LinuxMint',
17
17
  ]
18
18
 
@@ -139,8 +139,10 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
139
139
  def get_arguments(key, value, mapping, objectinfo)
140
140
  # In the case of attributes, return a list of key=vlaue
141
141
  if key == :attributes
142
- raise Puppet::Error, "Attributes must be a list of pairs key=value on #{@resource.class.name}[#{@resource.name}]" \
143
- unless value and value.is_a? Hash
142
+ unless value and value.is_a? Hash
143
+ raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{class_name}[%{resource_name}]") %
144
+ { class_name: @resource.class.name, resource_name: @resource.name }
145
+ end
144
146
  return value.map { |k,v| k.to_s.strip + "=" + v.to_s.strip}
145
147
  end
146
148
 
@@ -169,9 +171,11 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
169
171
  def verify_group(value)
170
172
  if value.is_a? Integer
171
173
  groupname = groupname_by_id(value)
172
- raise ArgumentError, "AIX group must be a valid existing group" unless groupname
174
+ #TRANSLATORS 'AIX' is the name of the operating system and should not be translated
175
+ raise ArgumentError, _("AIX group must be a valid existing group") unless groupname
173
176
  else
174
- raise ArgumentError, "AIX group must be a valid existing group" unless groupid_by_name(value)
177
+ #TRANSLATORS 'AIX' is the name of the operating system and should not be translated
178
+ raise ArgumentError, _("AIX group must be a valid existing group") unless groupid_by_name(value)
175
179
  groupname = value
176
180
  end
177
181
  groupname
@@ -207,8 +211,11 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
207
211
  #expiry_date = d.strftime("%Y-%m-%d")
208
212
  expiry_date = "20#{$5}-#{$1}-#{$2}"
209
213
  else
210
- Puppet.warn("Could not convert AIX expires date '#{value}' on #{@resource.class.name}[#{@resource.name}]") \
211
- unless value == '0'
214
+ unless value == '0'
215
+ #TRANSLATORS 'AIX' is the name of an operating system and should not be translated
216
+ Puppet.warn(_("Could not convert AIX expires date '%{value}' on %{class_name}[%{resource_name}]") %
217
+ { value: value, class_name: @resource.class.name, resource_name: @resource.name })
218
+ end
212
219
  expiry_date = :absent
213
220
  end
214
221
  expiry_date
@@ -46,7 +46,8 @@ Puppet::Type.type(:user).provide :openbsd, :parent => :useradd do
46
46
  begin
47
47
  return unmunge(shadow_property, ent.send(method))
48
48
  rescue => detail
49
- Puppet.warning "ruby-shadow doesn't support #{method}"
49
+ #TRANSLATORS 'ruby-shadow' is a Ruby gem library
50
+ Puppet.warning _("ruby-shadow doesn't support %{method}") % { method: method }
50
51
  end
51
52
  end
52
53
  end