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
@@ -25,6 +25,7 @@ Puppet::Face.define(:man, '0.0.1') do
25
25
  action(:man) do
26
26
  summary _("Display the manual page for a Puppet subcommand.")
27
27
  arguments _("<subcommand>")
28
+ #TRANSLATORS '--render-as s' is a command line option and should not be translated
28
29
  returns _(<<-'EOT')
29
30
  The man data, in Markdown format, suitable for consumption by Ronn.
30
31
 
@@ -57,7 +57,7 @@ Puppet::Face.define(:module, '1.0.0') do
57
57
 
58
58
  when_rendering :console do |return_value|
59
59
  # Get the string representation of the Pathname object.
60
- _("Module built: ") + return_value.expand_path.to_s
60
+ _("Module built: %{path}") % { path: return_value.expand_path.to_s }
61
61
  end
62
62
  end
63
63
  end
@@ -109,20 +109,10 @@ Puppet::Face.define(:module, '1.0.0') do
109
109
  end
110
110
 
111
111
  def warn_unmet_dependencies(environment)
112
- error_types = {
113
- :non_semantic_version => {
114
- :title => _("Non semantic version dependency")
115
- },
116
- :missing => {
117
- :title => _("Missing dependency")
118
- },
119
- :version_mismatch => {
120
- :title => _("Module '%s' (v%s) fails to meet some dependencies:")
121
- }
122
- }
112
+ error_types = [:non_semantic_version, :version_mismatch, :missing]
123
113
 
124
114
  @unmet_deps = {}
125
- error_types.each_key do |type|
115
+ error_types.each do |type|
126
116
  @unmet_deps[type] = Hash.new do |hash, key|
127
117
  hash[key] = { :errors => [], :parent => nil }
128
118
  end
@@ -160,19 +150,18 @@ Puppet::Face.define(:module, '1.0.0') do
160
150
  error_display_order = [:non_semantic_version, :version_mismatch, :missing]
161
151
  error_display_order.each do |type|
162
152
  unless @unmet_deps[type].empty?
163
- @unmet_deps[type].keys.sort_by {|dep| dep }.each do |dep|
153
+ @unmet_deps[type].keys.sort.each do |dep|
164
154
  name = dep.gsub('/', '-')
165
- title = error_types[type][:title]
166
155
  errors = @unmet_deps[type][dep][:errors]
167
156
  version = @unmet_deps[type][dep][:version]
168
157
 
169
158
  msg = case type
170
159
  when :version_mismatch
171
- title % [name, version] + "\n"
160
+ _("Module '%{name}' (v%{version}) fails to meet some dependencies:\n") % { name: name, version: version }
172
161
  when :non_semantic_version
173
- title + " '#{name}' (v#{version}):\n"
162
+ _("Non semantic version dependency %{name} (v%{version}):\n") % { name: name, version: version }
174
163
  else
175
- title + " '#{name}':\n"
164
+ _("Missing dependency '%{name}':\n") % { name: name }
176
165
  end
177
166
 
178
167
  errors.each { |error_string| msg << " #{error_string}\n" }
@@ -63,7 +63,13 @@ Puppet::Face.define(:module, '1.0.0') do
63
63
  name = name.gsub('/', '-')
64
64
 
65
65
  Puppet::ModuleTool.set_option_defaults options
66
- Puppet.notice _("Preparing to uninstall '%{name}'") % { name: name } << (options[:version] ? " (#{colorize(:cyan, options[:version].sub(/^(?=\d)/, 'v'))})" : '') << " ..."
66
+ message = if options[:version]
67
+ module_version = colorize(:cyan, options[:version].sub(/^(?=\d)/, 'v'))
68
+ _("Preparing to uninstall '%{name}' (%{module_version}) ...") % { name: name, module_version: module_version }
69
+ else
70
+ _("Preparing to uninstall '%{name}' ...") % { name: name }
71
+ end
72
+ Puppet.notice message
67
73
  Puppet::ModuleTool::Applications::Uninstaller.run(name, options)
68
74
  end
69
75
 
@@ -73,8 +79,13 @@ Puppet::Face.define(:module, '1.0.0') do
73
79
  exit 1
74
80
  else
75
81
  mod = return_value[:affected_modules].first
76
- module_version = mod.version ? " (#{colorize(:cyan, mod.version.to_s.sub(/^(?=\d)/, 'v'))})" : ''
77
- _("Removed '%{name}'%{module_version} from %{path}") % { name: return_value[:module_name], module_version: module_version, path: mod.modulepath }
82
+ message = if mod.version
83
+ module_version = colorize(:cyan, mod.version.to_s.sub(/^(?=\d)/, 'v'))
84
+ _("Removed '%{name}' (%{module_version}) from %{path}") % { name: return_value[:module_name], module_version: module_version, path: mod.modulepath }
85
+ else
86
+ _("Removed '%{name}' from %{path}") % { name: return_value[:module_name], path: mod.modulepath }
87
+ end
88
+ message
78
89
  end
79
90
  end
80
91
  end
@@ -17,6 +17,7 @@ Puppet::Indirector::Face.define(:node, '0.0.1') do
17
17
  find = get_action(:find)
18
18
  find.summary _("Retrieve a node object.")
19
19
  find.arguments _("<host>")
20
+ #TRANSLATORS the following are specific names and should not be translated `classes`, `environment`, `expiration`, `name`, `parameters`, Puppet::Node
20
21
  find.returns _(<<-'EOT')
21
22
  A hash containing the node's `classes`, `environment`, `expiration`, `name`,
22
23
  `parameters` (its facts, combined with any ENC-set parameters), and `time`.
@@ -13,6 +13,7 @@ Puppet::Indirector::Face.define(:status, '0.0.1') do
13
13
  find = get_action(:find)
14
14
  find.default = true
15
15
  find.summary _("Check status of puppet master server.")
16
+ #TRANSLATORS the string 'Puppet::Status' is a Puppet language object and should not be translated
16
17
  find.returns _(<<-'EOT')
17
18
  A "true" response or a low-level connection error. When used from the Ruby
18
19
  API: returns a Puppet::Status object.
@@ -46,7 +46,8 @@ class Puppet::FileServing::Base
46
46
  def links=(value)
47
47
  value = value.to_sym
48
48
  value = :manage if value == :ignore
49
- raise(ArgumentError, ":links can only be set to :manage or :follow") unless [:manage, :follow].include?(value)
49
+ #TRANSLATORS ':link', ':manage', ':follow' should not be translated
50
+ raise(ArgumentError, _(":links can only be set to :manage or :follow")) unless [:manage, :follow].include?(value)
50
51
  @links = value
51
52
  end
52
53
 
@@ -4,6 +4,7 @@ require 'puppet/file_serving/mount'
4
4
  require 'puppet/file_serving/mount/file'
5
5
  require 'puppet/file_serving/mount/modules'
6
6
  require 'puppet/file_serving/mount/plugins'
7
+ require 'puppet/file_serving/mount/locales'
7
8
  require 'puppet/file_serving/mount/pluginfacts'
8
9
  require 'puppet/file_serving/mount/tasks'
9
10
 
@@ -81,6 +82,8 @@ class Puppet::FileServing::Configuration
81
82
  @mounts["modules"].allow('*') if @mounts["modules"].empty?
82
83
  @mounts["plugins"] ||= Mount::Plugins.new("plugins")
83
84
  @mounts["plugins"].allow('*') if @mounts["plugins"].empty?
85
+ @mounts["locales"] ||= Mount::Locales.new("locales")
86
+ @mounts["locales"].allow('*') if @mounts["locales"].empty?
84
87
  @mounts["pluginfacts"] ||= Mount::PluginFacts.new("pluginfacts")
85
88
  @mounts["pluginfacts"].allow('*') if @mounts["pluginfacts"].empty?
86
89
  @mounts["tasks"] ||= Mount::Tasks.new("tasks")
@@ -13,9 +13,9 @@ class Puppet::FileServing::Configuration::Parser
13
13
  @mounts = {}
14
14
  @count = 0
15
15
 
16
- File.open(@file) { |f|
16
+ File.open(@file) do |f|
17
17
  mount = nil
18
- f.each_line { |line|
18
+ f.each_line do |line|
19
19
  # Have the count increment at the top, in case we throw exceptions.
20
20
  @count += 1
21
21
 
@@ -37,13 +37,17 @@ class Puppet::FileServing::Configuration::Parser
37
37
  when "deny"
38
38
  deny(mount, value)
39
39
  else
40
- raise ArgumentError.new(_("Invalid argument '%{var}' in %{file}, line %{line_num}") % { var: var, file: @file.filename, line_num: @count })
40
+ error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
41
+ raise ArgumentError.new(_("Invalid argument '%{var}' at %{error_location}") %
42
+ { var: var, error_location: error_location_str })
41
43
  end
42
44
  else
43
- raise ArgumentError.new(_("Invalid line '%{line}' at %{file}, line %{line_num}") % { line: line.chomp, file: @file.filename, line_num: @count })
45
+ error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
46
+ raise ArgumentError.new(_("Invalid entry at %{error_location}: '%{file_text}'") %
47
+ { file_text: line.chomp, error_location: error_location_str })
44
48
  end
45
- }
46
- }
49
+ end
50
+ end
47
51
 
48
52
  validate
49
53
 
@@ -67,7 +71,9 @@ class Puppet::FileServing::Configuration::Parser
67
71
  mount.info _("allowing %{val} access") % { val: val }
68
72
  mount.allow(val)
69
73
  rescue Puppet::AuthStoreError => detail
70
- raise ArgumentError.new(_("%{detail} in %{file}, line %{line_num}") % { detail: detail.to_s, file: @file, line_num: @count })
74
+ error_location_str = Puppet::Util::Errors.error_location(@file, @count)
75
+ raise ArgumentError.new("%{detail} %{error_location}" %
76
+ { detail: detail.to_s, error_location: error_location_str })
71
77
  end
72
78
  }
73
79
  end
@@ -79,14 +85,20 @@ class Puppet::FileServing::Configuration::Parser
79
85
  mount.info _("denying %{val} access") % { val: val }
80
86
  mount.deny(val)
81
87
  rescue Puppet::AuthStoreError => detail
82
- raise ArgumentError.new(_("%{detail} in %{file}, line %{line_num}") % { detail: detail.to_s, file: @file, line_num: @count })
88
+ error_location_str = Puppet::Util::Errors.error_location(@file, @count)
89
+ raise ArgumentError.new("%{detail} %{error_location}" %
90
+ { detail: detail.to_s, error_location: error_location_str })
83
91
  end
84
92
  }
85
93
  end
86
94
 
87
95
  # Create a new mount.
88
96
  def newmount(name)
89
- raise ArgumentError.new(_("%{mount} is already mounted at %{name} in %{file}, line %{line_num}") % { mount: @mounts[name], name: name, file: @file, line_num: @count }) if @mounts.include?(name)
97
+ if @mounts.include?(name)
98
+ error_location_str = Puppet::Util::Errors.error_location(@file, @count)
99
+ raise ArgumentError.new(_("%{mount} is already mounted at %{name} at %{error_location}") %
100
+ { mount: @mounts[name], name: name, error_location: error_location_str })
101
+ end
90
102
  case name
91
103
  when "modules"
92
104
  mount = Mount::Modules.new(name)
@@ -94,6 +106,8 @@ class Puppet::FileServing::Configuration::Parser
94
106
  mount = Mount::Plugins.new(name)
95
107
  when "tasks"
96
108
  mount = Mount::Tasks.new(name)
109
+ when "locales"
110
+ mount = Mount::Locales.new(name)
97
111
  else
98
112
  mount = Mount::File.new(name)
99
113
  end
@@ -0,0 +1,35 @@
1
+ require 'puppet/file_serving/mount'
2
+
3
+ # Find files in the modules' locales directories.
4
+ # This is a very strange mount because it merges
5
+ # many directories into one.
6
+ class Puppet::FileServing::Mount::Locales < Puppet::FileServing::Mount
7
+ # Return an instance of the appropriate class.
8
+ def find(relative_path, request)
9
+ return nil unless mod = request.environment.modules.find { |m| m.locale(relative_path) }
10
+
11
+ path = mod.locale(relative_path)
12
+
13
+ path
14
+ end
15
+
16
+ def search(relative_path, request)
17
+ # We currently only support one kind of search on locales - return
18
+ # them all.
19
+ Puppet.debug("Warning: calling Locales.search with empty module path.") if request.environment.modules.empty?
20
+ paths = request.environment.modules.find_all { |mod| mod.locales? }.collect { |mod| mod.locale_directory }
21
+ if paths.empty?
22
+ # If the modulepath is valid then we still need to return a valid root
23
+ # directory for the search, but make sure nothing inside it is
24
+ # returned.
25
+ request.options[:recurse] = false
26
+ request.environment.modulepath.empty? ? nil : request.environment.modulepath
27
+ else
28
+ paths
29
+ end
30
+ end
31
+
32
+ def valid?
33
+ true
34
+ end
35
+ end
data/lib/puppet/forge.rb CHANGED
@@ -134,7 +134,8 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
134
134
  Puppet::ModuleTool::Metadata.new.add_dependency(dep['name'], dep['version_requirement'], dep['repository'])
135
135
  Puppet::ModuleTool.parse_module_dependency(release, dep, strict_semver)[0..1]
136
136
  rescue ArgumentError => e
137
- raise ArgumentError, "Malformed dependency: #{dep['name']}. Exception was: #{e}"
137
+ raise ArgumentError, _("Malformed dependency: %{name}.") % { name: dep['name'] } +
138
+ ' ' + _("Exception was: %{detail}") % { detail: e }
138
139
  end
139
140
  end
140
141
  else
@@ -32,12 +32,12 @@ module Puppet::Forge::Errors
32
32
  #
33
33
  # @return [String] the multiline version of the error message
34
34
  def multiline
35
- _(<<-EOS).chomp % { uri: @uri }
36
- Could not connect via HTTPS to %{uri}
37
- Unable to verify the SSL certificate
38
- The certificate may not be signed by a valid CA
39
- The CA bundle included with OpenSSL may not be valid or up to date
40
- EOS
35
+ message = []
36
+ message << _('Could not connect via HTTPS to %{uri}') % { uri: @uri }
37
+ message << _(' Unable to verify the SSL certificate')
38
+ message << _(' The certificate may not be signed by a valid CA')
39
+ message << _(' The CA bundle included with OpenSSL may not be valid or up to date')
40
+ message.join("\n")
41
41
  end
42
42
  end
43
43
 
@@ -59,12 +59,12 @@ Could not connect via HTTPS to %{uri}
59
59
  #
60
60
  # @return [String] the multiline version of the error message
61
61
  def multiline
62
- _(<<-EOS).chomp % { uri: @uri, detail: @detail }
63
- Could not connect to %{uri}
64
- There was a network communications problem
65
- The error we caught said '%{detail}'
66
- Check your network connection and try again
67
- EOS
62
+ message = []
63
+ message << _('Could not connect to %{uri}') % { uri: @uri }
64
+ message << _(' There was a network communications problem')
65
+ message << _(" The error we caught said '%{detail}'") % { detail: @detail }
66
+ message << _(' Check your network connection and try again')
67
+ message.join("\n")
68
68
  end
69
69
  end
70
70
 
@@ -89,9 +89,11 @@ Could not connect to %{uri}
89
89
  rescue JSON::ParserError
90
90
  end
91
91
 
92
- message = _("Request to Puppet Forge failed. Detail: ")
93
- message << @message << " / " if @message
94
- message << @response << "."
92
+ message = if @message
93
+ _("Request to Puppet Forge failed.") + ' ' + _("Detail: %{detail}.") % { detail: "#{@message} / #{@response}" }
94
+ else
95
+ _("Request to Puppet Forge failed.") + ' ' + _("Detail: %{detail}.") % { detail: @response }
96
+ end
95
97
  super(message, original)
96
98
  end
97
99
 
@@ -99,13 +101,13 @@ Could not connect to %{uri}
99
101
  #
100
102
  # @return [String] the multiline version of the error message
101
103
  def multiline
102
- message = _(<<-EOS).chomp % { uri: @uri, response: @response }
103
- Request to Puppet Forge failed.
104
- The server being queried was %{uri}
105
- The HTTP response we received was '%{response}'
106
- EOS
107
- message << _("\n The message we received said '%{message}'") % { message: @message } if @message
108
- message
104
+
105
+ message = []
106
+ message << _('Request to Puppet Forge failed.')
107
+ message << _(' The server being queried was %{uri}') % { uri: @uri }
108
+ message << _(" The HTTP response we received was '%{response}'") % { response: @response }
109
+ message << _(" The message we received said '%{message}'") % { message: @message } if @message
110
+ message.join("\n")
109
111
  end
110
112
  end
111
113
 
@@ -12,6 +12,7 @@ Puppet::Functions.create_function(:binary_file, Puppet::Functions::InternalFunct
12
12
  def binary_file(scope, unresolved_path)
13
13
  path = Puppet::Parser::Files.find_file(unresolved_path, scope.compiler.environment)
14
14
  unless path && Puppet::FileSystem.exist?(path)
15
+ #TRANSLATORS the string "binary_file()" should not be translated
15
16
  raise Puppet::ParseError, _("binary_file(): The given file '%{unresolved_path}' does not exist") % { unresolved_path: unresolved_path }
16
17
  end
17
18
  Puppet::Pops::Types::PBinaryType::Binary.from_binary_string(Puppet::FileSystem.binread(path))
@@ -117,8 +117,11 @@ Puppet::Functions.create_function(:each) do
117
117
 
118
118
  def foreach_Hash_1(hash)
119
119
  enumerator = hash.each_pair
120
- hash.size.times do
121
- yield(enumerator.next)
120
+ begin
121
+ hash.size.times do
122
+ yield(enumerator.next)
123
+ end
124
+ rescue StopIteration
122
125
  end
123
126
  # produces the receiver
124
127
  hash
@@ -126,8 +129,11 @@ Puppet::Functions.create_function(:each) do
126
129
 
127
130
  def foreach_Hash_2(hash)
128
131
  enumerator = hash.each_pair
129
- hash.size.times do
130
- yield(*enumerator.next)
132
+ begin
133
+ hash.size.times do
134
+ yield(*enumerator.next)
135
+ end
136
+ rescue StopIteration
131
137
  end
132
138
  # produces the receiver
133
139
  hash
@@ -26,8 +26,10 @@ Puppet::Functions.create_function(:eyaml_lookup_key) do
26
26
  # Can't do this with an argument_mismatch dispatcher since there is no way to declare a struct that at least
27
27
  # contains some keys but may contain other arbitrary keys.
28
28
  unless options.include?('path')
29
+ #TRANSLATORS 'eyaml_lookup_key':, 'path', 'paths' 'glob', 'globs', 'mapped_paths', and lookup_key should not be translated
29
30
  raise ArgumentError,
30
- "'eyaml_lookup_key': one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml when using this lookup_key function"
31
+ _("'eyaml_lookup_key': one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml"\
32
+ " when using this lookup_key function")
31
33
  end
32
34
 
33
35
  # nil key is used to indicate that the cache contains the raw content of the eyaml file
@@ -48,7 +50,7 @@ Puppet::Functions.create_function(:eyaml_lookup_key) do
48
50
  if data.is_a?(Hash)
49
51
  Puppet::Pops::Lookup::HieraConfig.symkeys_to_string(data)
50
52
  else
51
- Puppet.warning("#{path}: file does not contain a valid yaml hash")
53
+ Puppet.warning(_("%{path}: file does not contain a valid yaml hash") % { path: path })
52
54
  {}
53
55
  end
54
56
  rescue YAML::SyntaxError => ex
@@ -91,8 +91,8 @@
91
91
  # merged hash. If the same key exists in multiple source hashes, Puppet will
92
92
  # recursively merge hash or array values (with duplicate values removed from
93
93
  # arrays). For conflicting scalar values, the highest-priority value will win.
94
- # * `{'strategy' => 'first|unique|hash'}` --- Same as the string versions of these
95
- # merge behaviors.
94
+ # * `{'strategy' => 'first'}`, `{'strategy' => 'unique'}`,
95
+ # or `{'strategy' => 'hash'}` --- Same as the string versions of these merge behaviors.
96
96
  # * `{'strategy' => 'deep', <DEEP OPTION> => <VALUE>, ...}` --- Same as `'deep'`,
97
97
  # but can adjust the merge with additional options. The available options are:
98
98
  # * `'knockout_prefix'` (string or undef) --- A string prefix to indicate a
@@ -88,11 +88,21 @@ Puppet::Functions.create_function(:map) do
88
88
  end
89
89
 
90
90
  def map_Hash_1(hash)
91
- hash.map {|x, y| yield([x, y]) }
91
+ result = []
92
+ begin
93
+ hash.map {|x, y| result << yield([x, y]) }
94
+ rescue StopIteration
95
+ end
96
+ result
92
97
  end
93
98
 
94
99
  def map_Hash_2(hash)
95
- hash.map {|x, y| yield(x, y) }
100
+ result = []
101
+ begin
102
+ hash.map {|x, y| result << yield(x, y) }
103
+ rescue StopIteration
104
+ end
105
+ result
96
106
  end
97
107
 
98
108
  def map_Enumerable_1(enumerable)
@@ -102,9 +102,8 @@ Puppet::Functions.create_function(:slice) do
102
102
  raise ArgumentError, _("slice(): block must define at least one parameter. Block has 0.")
103
103
  end
104
104
  unless serving_size == 1 || serving_size == slice_size
105
- raise ArgumentError, _("slice(): block must define one parameter, or ") +
106
- _("the same number of parameters as the given size of the slice (%{slice_size}). Block has %{serving_size}; ") % { slice_size: slice_size, serving_size: serving_size }+
107
- pblock.parameter_names.join(', ')
105
+ raise ArgumentError, _("slice(): block must define one parameter, or the same number of parameters as the given size of the slice (%{slice_size}). Block has %{serving_size}; %{parameter_names}") %
106
+ { slice_size: slice_size, serving_size: serving_size, parameter_names: pblock.parameter_names.join(', ') }
108
107
  end
109
108
  serving_size
110
109
  end