puppet 5.3.3 → 5.3.4

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 +3433 -3416
  290. checksums.yaml +0 -7
  291. data/spec/unit/gettext_config_spec.rb +0 -57
@@ -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
 
@@ -83,7 +83,15 @@ private
83
83
  def unique_sections_in(ini, file, allowed_section_names)
84
84
  ini.section_lines.collect do |section|
85
85
  if !allowed_section_names.empty? && !allowed_section_names.include?(section.name)
86
- raise(Puppet::Error, _("Illegal section '%{name}' in config file %{file} at line %{line}. The only valid puppet.conf sections are: [%{allowed_sections}]. Please use the directory environments feature to specify environments. (See https://docs.puppet.com/puppet/latest/reference/environments.html)") % { name: section.name, file: file, line: section.line_number, allowed_sections: allowed_section_names.join(", ") })
86
+ error_location_str = Puppet::Util::Errors.error_location(file, section.line_number)
87
+ message = _("Illegal section '%{name}' in config file at %{error_location}.") %
88
+ { name: section.name, error_location: error_location_str }
89
+ #TRANSLATORS 'puppet.conf' is the name of the puppet configuration file and should not be translated.
90
+ message += ' ' + _("The only valid puppet.conf sections are: [%{allowed_sections_list}].") %
91
+ { allowed_sections_list: allowed_section_names.join(", ") }
92
+ message += ' ' + _("Please use the directory environments feature to specify environments.")
93
+ message += ' ' + _("(See https://docs.puppet.com/puppet/latest/reference/environments.html)")
94
+ raise(Puppet::Error, message)
87
95
  end
88
96
  section.name
89
97
  end.uniq
@@ -126,13 +134,15 @@ private
126
134
  if str =~ /^\s*(\w+)\s*=\s*([\w\d]+)\s*$/
127
135
  param, value = $1.intern, $2
128
136
  result[param] = value
129
- raise ArgumentError, "Invalid file option '#{param}'" unless [:owner, :mode, :group].include?(param)
137
+ unless [:owner, :mode, :group].include?(param)
138
+ raise ArgumentError, _("Invalid file option '%{parameter}'") % { parameter: param }
139
+ end
130
140
 
131
141
  if param == :mode and value !~ /^\d+$/
132
- raise ArgumentError, "File modes must be numbers"
142
+ raise ArgumentError, _("File modes must be numbers")
133
143
  end
134
144
  else
135
- raise ArgumentError, "Could not parse '#{string}'"
145
+ raise ArgumentError, _("Could not parse '%{string}'") % { string: string }
136
146
  end
137
147
  end
138
148
  ''
@@ -66,13 +66,11 @@ class Puppet::Settings::EnvironmentConf
66
66
  if disable_per_environment_manifest
67
67
  environment_conf_manifest = absolute(raw_setting(:manifest))
68
68
  if environment_conf_manifest && fallback_manifest_directory != environment_conf_manifest
69
- errmsg = ["The 'disable_per_environment_manifest' setting is true, but the",
70
- "environment located at #{@path_to_env} has a manifest setting in its",
71
- "environment.conf of '#{environment_conf_manifest}' which does not match",
72
- "the default_manifest setting '#{puppet_conf_manifest}'. If this",
73
- "environment is expecting to find modules in",
74
- "'#{environment_conf_manifest}', they will not be available!"]
75
- Puppet.err(errmsg.join(' '))
69
+ #TRANSLATORS 'disable_per_environment_manifest' is a setting and 'environment.conf' is a file name and should not be translated
70
+ message = _("The 'disable_per_environment_manifest' setting is true, but the environment located at %{path_to_env} has a manifest setting in its environment.conf of '%{environment_conf}' which does not match the default_manifest setting '%{puppet_conf}'.") %
71
+ { path_to_env: @path_to_env, environment_conf: environment_conf_manifest, puppet_conf: puppet_conf_manifest }
72
+ message += ' ' + _("If this environment is expecting to find modules in '%{environment_conf}', they will not be available!") % { environment_conf: environment_conf_manifest }
73
+ Puppet.err(message)
76
74
  end
77
75
  fallback_manifest_directory.to_s
78
76
  else
@@ -138,13 +136,25 @@ class Puppet::Settings::EnvironmentConf
138
136
  section_keys = config.sections.keys
139
137
  main = config.sections[:main]
140
138
  if section_keys.size > 1
141
- Puppet.warning(_("Invalid sections in environment.conf at '%{path_to_conf_file}'. Environment conf may not have sections. The following sections are being ignored: '%{sections}'") % { path_to_conf_file: path_to_conf_file, sections: (section_keys - [:main]).join(',') })
139
+ # warn once per config file path
140
+ Puppet.warn_once(
141
+ :invalid_settings_section, "EnvironmentConf-section:#{path_to_conf_file}",
142
+ _("Invalid sections in environment.conf at '%{path_to_conf_file}'. Environment conf may not have sections. The following sections are being ignored: '%{sections}'") % {
143
+ path_to_conf_file: path_to_conf_file,
144
+ sections: (section_keys - [:main]).join(',')
145
+ })
142
146
  valid = false
143
147
  end
144
148
 
145
149
  extraneous_settings = main.settings.map(&:name) - VALID_SETTINGS
146
150
  if !extraneous_settings.empty?
147
- Puppet.warning(_("Invalid settings in environment.conf at '%{path_to_conf_file}'. The following unknown setting(s) are being ignored: %{ignored_settings}") % { path_to_conf_file: path_to_conf_file, ignored_settings: extraneous_settings.join(', ') })
151
+ # warn once per config file path
152
+ Puppet.warn_once(
153
+ :invalid_settings, "EnvironmentConf-settings:#{path_to_conf_file}",
154
+ _("Invalid settings in environment.conf at '%{path_to_conf_file}'. The following unknown setting(s) are being ignored: %{ignored_settings}") % {
155
+ path_to_conf_file: path_to_conf_file,
156
+ ignored_settings: extraneous_settings.join(', ')
157
+ })
148
158
  valid = false
149
159
  end
150
160
 
@@ -24,7 +24,7 @@ class Puppet::SSL::Base
24
24
  end
25
25
 
26
26
  def self.wrapped_class
27
- raise(Puppet::DevError, "#{self} has not declared what class it wraps") unless defined?(@wrapped_class)
27
+ raise(Puppet::DevError, _("%{name} has not declared what class it wraps") % { name: self }) unless defined?(@wrapped_class)
28
28
  @wrapped_class
29
29
  end
30
30
 
@@ -40,7 +40,7 @@ class Puppet::SSL::Base
40
40
  end
41
41
 
42
42
  def generate
43
- raise Puppet::DevError, "#{self.class} did not override 'generate'"
43
+ raise Puppet::DevError, _("%{class_name} did not override 'generate'") % { class_name: self.class }
44
44
  end
45
45
 
46
46
  def initialize(name)
@@ -64,8 +64,13 @@ class Puppet::SSL::Base
64
64
 
65
65
  # Create an instance of our Puppet::SSL::* class using a given instance of the wrapped class
66
66
  def self.from_instance(instance, name = nil)
67
- raise ArgumentError, "Object must be an instance of #{wrapped_class}, #{instance.class} given" unless instance.is_a? wrapped_class
68
- raise ArgumentError, "Name must be supplied if it cannot be determined from the instance" if name.nil? and !instance.respond_to?(:subject)
67
+ unless instance.is_a?(wrapped_class)
68
+ raise ArgumentError, _("Object must be an instance of %{class_name}, %{actual_class} given") %
69
+ { class_name: wrapped_class, actual_class: instance.class }
70
+ end
71
+ if name.nil? and !instance.respond_to?(:subject)
72
+ raise ArgumentError, _("Name must be supplied if it cannot be determined from the instance")
73
+ end
69
74
 
70
75
  name ||= name_from_subject(instance.subject)
71
76
  result = new(name)
@@ -70,12 +70,18 @@ module Puppet::SSL::Oids
70
70
  ["1.3.6.1.4.1.34380.1.3.13", 'pp_auth_role', 'Puppet Node Role Name for Authorization'],
71
71
  ]
72
72
 
73
+ @did_register_puppet_oids = false
74
+
73
75
  # Register our custom Puppet OIDs with OpenSSL so they can be used as CSR
74
76
  # extensions. Without registering these OIDs, OpenSSL will fail when it
75
77
  # encounters such an extension in a CSR.
76
78
  def self.register_puppet_oids()
77
- PUPPET_OIDS.each do |oid_defn|
78
- OpenSSL::ASN1::ObjectId.register(*oid_defn)
79
+ if !@did_register_puppet_oids
80
+ PUPPET_OIDS.each do |oid_defn|
81
+ OpenSSL::ASN1::ObjectId.register(*oid_defn)
82
+ end
83
+
84
+ @did_register_puppet_oids = true
79
85
  end
80
86
  end
81
87
 
@@ -24,12 +24,11 @@ class Puppet::SyntaxCheckers::Base64 < Puppet::Plugins::SyntaxCheckers::SyntaxCh
24
24
  # simply skips all non base64 characters
25
25
  Base64.strict_decode64(cleaned_text)
26
26
  rescue => e
27
- if (cleaned_text.bytes.to_a.size * 8) % 6 != 0
28
- msg2 = _("padding is not correct")
29
- else
30
- msg2 = _("contains letters outside strict base 64 range (or whitespace)")
31
- end
32
- msg = _("Base64 syntax checker: Cannot parse invalid Base64 string - %{msg2}") % { msg2: msg2 }
27
+ msg = if (cleaned_text.bytes.to_a.size * 8) % 6 != 0
28
+ _("Base64 syntax checker: Cannot parse invalid Base64 string - padding is not correct")
29
+ else
30
+ _("Base64 syntax checker: Cannot parse invalid Base64 string - contains letters outside strict base 64 range (or whitespace)")
31
+ end
33
32
 
34
33
  # TODO: improve the pops API to allow simpler diagnostic creation while still maintaining capabilities
35
34
  # and the issue code. (In this case especially, where there is only a single error message being issued).
@@ -93,7 +93,7 @@ class Puppet::Transaction
93
93
 
94
94
  perform_pre_run_checks
95
95
 
96
- persistence.load if catalog.host_config?
96
+ persistence.load if persistence.enabled?(catalog)
97
97
 
98
98
  Puppet.info _("Applying configuration version '%{version}'") % { version: catalog.version } if catalog.version
99
99
 
@@ -145,7 +145,7 @@ class Puppet::Transaction
145
145
  end
146
146
  end
147
147
 
148
- persistence.save if catalog.host_config?
148
+ persistence.save if persistence.enabled?(catalog)
149
149
  end
150
150
 
151
151
  # Graph cycles are returned as an array of arrays
@@ -177,7 +177,7 @@ class Puppet::Transaction
177
177
  else
178
178
  resource.info _("Starting to evaluate the resource") if Puppet[:evaltrace] and @catalog.host_config?
179
179
  seconds = thinmark { block.call(resource) }
180
- resource.info _("Evaluated in %0.2f seconds") % seconds if Puppet[:evaltrace] and @catalog.host_config?
180
+ resource.info _("Evaluated in %{seconds} seconds") % { seconds: "%0.2f" % seconds } if Puppet[:evaltrace] and @catalog.host_config?
181
181
  end
182
182
  end
183
183
 
@@ -187,6 +187,9 @@ class Puppet::Transaction
187
187
  report.resources_failed_to_generate = true
188
188
  end
189
189
 
190
+ # mark the end of transaction evaluate.
191
+ report.transaction_completed = true
192
+
190
193
  Puppet.debug "Finishing transaction #{object_id}"
191
194
  end
192
195
 
@@ -262,6 +265,7 @@ class Puppet::Transaction
262
265
  resource_status(resource).skipped = true
263
266
  resource.debug("Resource is being skipped, unscheduling all events")
264
267
  event_manager.dequeue_all_events_for_resource(resource)
268
+ persistence.copy_skipped(resource.ref)
265
269
  else
266
270
  resource_status(resource).scheduled = true
267
271
  apply(resource, ancestor)
@@ -40,6 +40,14 @@ class Puppet::Transaction::Persistence
40
40
  @new_data["resources"][resource_name]["parameters"][param_name]["system_value"] = value
41
41
  end
42
42
 
43
+ def copy_skipped(resource_name)
44
+ @old_data["resources"] ||= {}
45
+ old_value = @old_data["resources"][resource_name]
46
+ if !old_value.nil?
47
+ @new_data["resources"][resource_name] = old_value
48
+ end
49
+ end
50
+
43
51
  # Load data from the persistence store on disk.
44
52
  def load
45
53
  filename = Puppet[:transactionstorefile]
@@ -52,7 +60,7 @@ class Puppet::Transaction::Persistence
52
60
  end
53
61
 
54
62
  result = nil
55
- Puppet::Util.benchmark(:debug, _("Loaded transaction store file")) do
63
+ Puppet::Util.benchmark(:debug, _("Loaded transaction store file in %{seconds} seconds")) do
56
64
  begin
57
65
  result = Puppet::Util::Yaml.load_file(filename, false, true)
58
66
  rescue Puppet::Util::Yaml::YamlLoadError => detail
@@ -81,4 +89,11 @@ class Puppet::Transaction::Persistence
81
89
  def save
82
90
  Puppet::Util::Yaml.dump(@new_data, Puppet[:transactionstorefile])
83
91
  end
92
+
93
+ # Use the catalog and run_mode to determine if persistence should be enabled or not
94
+ # @param [Puppet::Resource::Catalog] catalog catalog being processed
95
+ # @return [boolean] true if persistence is enabled
96
+ def enabled?(catalog)
97
+ catalog.host_config? && Puppet.run_mode.name == :agent
98
+ end
84
99
  end
@@ -130,6 +130,10 @@ class Puppet::Transaction::Report
130
130
  #
131
131
  attr_accessor :resources_failed_to_generate
132
132
 
133
+ # @return [Boolean] true if the transaction completed it's evaluate
134
+ #
135
+ attr_accessor :transaction_completed
136
+
133
137
  def self.from_data_hash(data)
134
138
  obj = self.allocate
135
139
  obj.initialize_from_hash(data)
@@ -171,6 +175,7 @@ class Puppet::Transaction::Report
171
175
  # @api private
172
176
  def compute_status(resource_metrics, change_metric)
173
177
  if resources_failed_to_generate ||
178
+ !transaction_completed ||
174
179
  (resource_metrics["failed"] || 0) > 0 ||
175
180
  (resource_metrics["failed_to_restart"] || 0) > 0
176
181
  'failed'
@@ -227,6 +232,7 @@ class Puppet::Transaction::Report
227
232
  @noop = Puppet[:noop]
228
233
  @noop_pending = false
229
234
  @corrective_change = false
235
+ @transaction_completed = false
230
236
  end
231
237
 
232
238
  # @api private
@@ -425,7 +425,7 @@ class Type
425
425
  when 1;
426
426
  [ [ /(.*)/m, [ [key_attributes.first] ] ] ]
427
427
  else
428
- raise Puppet::DevError,"you must specify title patterns when there are two or more key attributes"
428
+ raise Puppet::DevError, _("you must specify title patterns when there are two or more key attributes")
429
429
  end
430
430
  end
431
431
 
@@ -500,11 +500,10 @@ class Type
500
500
  # This is here for types that might still have the old method of defining
501
501
  # a parent class.
502
502
  unless options.is_a? Hash
503
- raise Puppet::DevError,
504
- "Options must be a hash, not #{options.inspect}"
503
+ raise Puppet::DevError, _("Options must be a hash, not %{type}") % { type: options.inspect }
505
504
  end
506
505
 
507
- raise Puppet::DevError, "Class #{self.name} already has a property named #{name}" if @validproperties.include?(name)
506
+ raise Puppet::DevError, _("Class %{class_name} already has a property named %{property}") % { class_name: self.name, property: name } if @validproperties.include?(name)
508
507
 
509
508
  if parent = options[:parent]
510
509
  options.delete(:parent)
@@ -590,7 +589,7 @@ class Type
590
589
 
591
590
  # @return [Boolean] Returns true if the given name is the name of an existing parameter
592
591
  def self.validparameter?(name)
593
- raise Puppet::DevError, "Class #{self} has not defined parameters" unless defined?(@parameters)
592
+ raise Puppet::DevError, _("Class %{class_name} has not defined parameters") % { class_name: self } unless defined?(@parameters)
594
593
  !!(@paramhash.include?(name) or @@metaparamhash.include?(name))
595
594
  end
596
595
 
@@ -674,7 +673,8 @@ class Type
674
673
  # make sure the parameter doesn't have any errors
675
674
  property.value = value
676
675
  rescue Puppet::Error, ArgumentError => detail
677
- error = Puppet::ResourceError.new("Parameter #{name} failed on #{ref}: #{detail}")
676
+ error = Puppet::ResourceError.new(_("Parameter %{name} failed on %{ref}: %{detail}") %
677
+ { name: name, ref: ref, detail: detail })
678
678
  adderrorcontext(error, detail)
679
679
  raise error
680
680
  end
@@ -696,7 +696,7 @@ class Type
696
696
  if @parameters.has_key?(attr)
697
697
  @parameters.delete(attr)
698
698
  else
699
- raise Puppet::DevError.new("Undefined attribute '#{attr}' in #{self}")
699
+ raise Puppet::DevError.new(_("Undefined attribute '%{attribute}' in %{name}") % { attribute: attr, name: self})
700
700
  end
701
701
  end
702
702
 
@@ -1018,8 +1018,8 @@ class Type
1018
1018
 
1019
1019
  if property = @parameters[:ensure]
1020
1020
  unless is.include? property
1021
- raise Puppet::DevError,
1022
- "The is value is not in the is array for '#{property.name}'"
1021
+ #TRANSLATORS 'is' is a variable name and should not be translated
1022
+ raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: property.name }
1023
1023
  end
1024
1024
  ensureis = is[property]
1025
1025
  if property.safe_insync?(ensureis) and property.should == :absent
@@ -1029,8 +1029,8 @@ class Type
1029
1029
 
1030
1030
  properties.each { |prop|
1031
1031
  unless is.include? prop
1032
- raise Puppet::DevError,
1033
- "The is value is not in the is array for '#{prop.name}'"
1032
+ #TRANSLATORS 'is' is a variable name and should not be translated
1033
+ raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: prop.name }
1034
1034
  end
1035
1035
 
1036
1036
  propis = is[prop]
@@ -1156,7 +1156,7 @@ class Type
1156
1156
  # Either requires providers or must be overridden.
1157
1157
  # @raise [Puppet::DevError] when there are no providers and the implementation has not overridden this method.
1158
1158
  def self.instances
1159
- raise Puppet::DevError, "#{self.name} has no providers and has not overridden 'instances'" if provider_hash.empty?
1159
+ raise Puppet::DevError, _("%{name} has no providers and has not overridden 'instances'") % { name: self.name } if provider_hash.empty?
1160
1160
 
1161
1161
  # Put the default provider first, then the rest of the suitable providers.
1162
1162
  provider_instances = {}
@@ -1289,9 +1289,7 @@ class Type
1289
1289
  end
1290
1290
 
1291
1291
  newmetaparam(:audit) do
1292
- desc "(This metaparameter is deprecated and will be ignored in a future release.)
1293
-
1294
- Marks a subset of this resource's unmanaged attributes for auditing. Accepts an
1292
+ desc "Marks a subset of this resource's unmanaged attributes for auditing. Accepts an
1295
1293
  attribute name, an array of attribute names, or `all`.
1296
1294
 
1297
1295
  Auditing a resource attribute has two effects: First, whenever a catalog
@@ -1312,12 +1310,6 @@ class Type
1312
1310
  and the second run will log the edit made by Puppet.)"
1313
1311
 
1314
1312
  validate do |list|
1315
- if Puppet.settings[:strict] != :off
1316
- # Only warn if `audit` metaparam came from a manifest
1317
- if file && line
1318
- puppet_deprecation_warning(_("The `audit` metaparameter is deprecated and will be ignored in a future release."), { :line => line, :file => file })
1319
- end
1320
- end
1321
1313
  list = Array(list).collect {|p| p.to_sym}
1322
1314
  unless list == [:all]
1323
1315
  list.each do |param|
@@ -1423,7 +1415,7 @@ class Type
1423
1415
  munge do |aliases|
1424
1416
  aliases = [aliases] unless aliases.is_a?(Array)
1425
1417
 
1426
- raise(ArgumentError, "Cannot add aliases without a catalog") unless @resource.catalog
1418
+ raise(ArgumentError, _("Cannot add aliases without a catalog")) unless @resource.catalog
1427
1419
 
1428
1420
  aliases.each do |other|
1429
1421
  if obj = @resource.catalog.resource(@resource.class.name, other)
@@ -1502,7 +1494,8 @@ class Type
1502
1494
  @value.each do |ref|
1503
1495
  unless @resource.catalog.resource(ref.to_s)
1504
1496
  description = self.class.direction == :in ? "dependency" : "dependent"
1505
- fail ResourceError, "Could not find #{description} #{ref} for #{resource.ref}"
1497
+ fail ResourceError, _("Could not find %{description} %{ref} for %{resource}") %
1498
+ { description: description, ref: ref, resource: resource.ref }
1506
1499
  end
1507
1500
  end
1508
1501
  end
@@ -1761,9 +1754,8 @@ end
1761
1754
  defaults = defaults.find_all { |provider| provider.specificity == max }
1762
1755
 
1763
1756
  if defaults.length > 1
1764
- Puppet.warning(
1765
- "Found multiple default providers for #{self.name}: #{defaults.collect { |i| i.name.to_s }.join(", ")}; using #{defaults[0].name}"
1766
- )
1757
+ Puppet.warning(_("Found multiple default providers for %{name}: %{provider_list}; using %{selected_provider}") %
1758
+ { name: self.name, provider_list: defaults.collect { |i| i.name.to_s }.join(", "), selected_provider: defaults[0].name })
1767
1759
  end
1768
1760
 
1769
1761
  @defaultprovider = defaults.shift unless defaults.empty?
@@ -1847,8 +1839,7 @@ end
1847
1839
  if provider = self.provider(pname)
1848
1840
  provider
1849
1841
  else
1850
- raise Puppet::DevError,
1851
- "Could not find parent provider #{pname} of #{name}"
1842
+ raise Puppet::DevError, _("Could not find parent provider %{parent} of %{name}") % { parent: pname, name: name }
1852
1843
  end
1853
1844
  end
1854
1845
  else
@@ -1924,7 +1915,7 @@ end
1924
1915
  provider_class = provider_class.class.name if provider_class.is_a?(Puppet::Provider)
1925
1916
 
1926
1917
  unless @resource.class.provider(provider_class)
1927
- raise ArgumentError, "Invalid #{@resource.class.name} provider '#{provider_class}'"
1918
+ raise ArgumentError, _("Invalid %{resource} provider '%{provider_class}'") % { resource: @resource.class.name, provider_class: provider_class}
1928
1919
  end
1929
1920
  end
1930
1921
 
@@ -2007,7 +1998,7 @@ end
2007
1998
  elsif klass = self.class.provider(name)
2008
1999
  @provider = klass.new(self)
2009
2000
  else
2010
- raise ArgumentError, "Could not find #{name} provider of #{self.class.name}"
2001
+ raise ArgumentError, _("Could not find %{name} provider of %{provider}") % { name: name, provider: self.class.name }
2011
2002
  end
2012
2003
  end
2013
2004
 
@@ -2124,7 +2115,7 @@ end
2124
2115
  #
2125
2116
  def autorelation(rel_type, rel_catalog = nil)
2126
2117
  rel_catalog ||= catalog
2127
- raise(Puppet::DevError, "You cannot add relationships without a catalog") unless rel_catalog
2118
+ raise Puppet::DevError, _("You cannot add relationships without a catalog") unless rel_catalog
2128
2119
 
2129
2120
  reqs = []
2130
2121
 
@@ -2435,11 +2426,12 @@ end
2435
2426
  if p.is_a?(Puppet::Property)
2436
2427
  p.sensitive = true
2437
2428
  elsif p.is_a?(Puppet::Parameter)
2438
- warning("Unable to mark '#{name}' as sensitive: #{name} is a parameter and not a property, and cannot be automatically redacted.")
2429
+ warning(_("Unable to mark '%{name}' as sensitive: %{name} is a parameter and not a property, and cannot be automatically redacted.") %
2430
+ { name: name })
2439
2431
  elsif self.class.attrclass(name)
2440
- warning("Unable to mark '#{name}' as sensitive: the property itself was not assigned a value.")
2432
+ warning(_("Unable to mark '%{name}' as sensitive: the property itself was not assigned a value.") % { name: name })
2441
2433
  else
2442
- err("Unable to mark '#{name}' as sensitive: the property itself is not defined on #{type}.")
2434
+ err(_("Unable to mark '%{name}' as sensitive: the property itself is not defined on %{type}.") % { name: name, type: type })
2443
2435
  end
2444
2436
  end
2445
2437
  end
@@ -2490,7 +2482,7 @@ end
2490
2482
  rescue ArgumentError, Puppet::Error, TypeError
2491
2483
  raise
2492
2484
  rescue => detail
2493
- error = Puppet::DevError.new( "Could not set #{attr} on #{self.class.name}: #{detail}")
2485
+ error = Puppet::DevError.new(_("Could not set %{attribute} on %{class_name}: %{detail}") % { attribute: attr, class_name: self.class.name, detail: detail })
2494
2486
  error.set_backtrace(detail.backtrace)
2495
2487
  raise error
2496
2488
  end