bolt 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bolt might be problematic. Click here for more details.

Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bolt/cli.rb +30 -131
  3. data/lib/bolt/config.rb +35 -9
  4. data/lib/bolt/executor.rb +33 -7
  5. data/lib/bolt/node.rb +19 -2
  6. data/lib/bolt/node/orch.rb +4 -4
  7. data/lib/bolt/node/ssh.rb +46 -21
  8. data/lib/bolt/node/winrm.rb +12 -23
  9. data/lib/bolt/outputter.rb +9 -0
  10. data/lib/bolt/outputter/human.rb +33 -4
  11. data/lib/bolt/outputter/json.rb +6 -1
  12. data/lib/bolt/pal.rb +87 -20
  13. data/lib/bolt/version.rb +1 -1
  14. data/modules/boltlib/lib/puppet/functions/run_command.rb +1 -1
  15. data/modules/boltlib/lib/puppet/functions/run_plan.rb +18 -1
  16. data/modules/boltlib/lib/puppet/functions/run_script.rb +1 -1
  17. data/modules/boltlib/lib/puppet/functions/run_task.rb +2 -1
  18. data/vendored/facter/lib/facter/virtual.rb +2 -0
  19. data/vendored/hiera/lib/hiera/config.rb +2 -2
  20. data/vendored/hiera/lib/hiera/version.rb +1 -1
  21. data/vendored/puppet/lib/hiera/puppet_function.rb +5 -2
  22. data/vendored/puppet/lib/hiera_puppet.rb +3 -3
  23. data/vendored/puppet/lib/puppet/agent/locker.rb +6 -5
  24. data/vendored/puppet/lib/puppet/application/filebucket.rb +23 -6
  25. data/vendored/puppet/lib/puppet/daemon.rb +2 -2
  26. data/vendored/puppet/lib/puppet/defaults.rb +42 -10
  27. data/vendored/puppet/lib/puppet/error.rb +5 -15
  28. data/vendored/puppet/lib/puppet/external/pson/common.rb +2 -2
  29. data/vendored/puppet/lib/puppet/face/module/build.rb +1 -0
  30. data/vendored/puppet/lib/puppet/face/module/install.rb +1 -0
  31. data/vendored/puppet/lib/puppet/face/module/search.rb +2 -1
  32. data/vendored/puppet/lib/puppet/face/module/uninstall.rb +1 -0
  33. data/vendored/puppet/lib/puppet/face/module/upgrade.rb +1 -0
  34. data/vendored/puppet/lib/puppet/file_bucket/dipper.rb +1 -1
  35. data/vendored/puppet/lib/puppet/file_serving/base.rb +2 -1
  36. data/vendored/puppet/lib/puppet/file_serving/configuration/parser.rb +21 -9
  37. data/vendored/puppet/lib/puppet/file_serving/http_metadata.rb +1 -1
  38. data/vendored/puppet/lib/puppet/forge.rb +2 -1
  39. data/vendored/puppet/lib/puppet/functions/binary_file.rb +1 -0
  40. data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
  41. data/vendored/puppet/lib/puppet/functions/module_directory.rb +41 -0
  42. data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -1
  43. data/vendored/puppet/lib/puppet/functions/unique.rb +1 -1
  44. data/vendored/puppet/lib/puppet/functions/yaml_data.rb +1 -1
  45. data/vendored/puppet/lib/puppet/gettext/config.rb +10 -5
  46. data/vendored/puppet/lib/puppet/graph/relationship_graph.rb +1 -1
  47. data/vendored/puppet/lib/puppet/indirector/catalog/compiler.rb +1 -1
  48. data/vendored/puppet/lib/puppet/indirector/exec.rb +1 -1
  49. data/vendored/puppet/lib/puppet/indirector/facts/facter.rb +3 -3
  50. data/vendored/puppet/lib/puppet/indirector/facts/network_device.rb +2 -2
  51. data/vendored/puppet/lib/puppet/indirector/file_bucket_file/file.rb +10 -3
  52. data/vendored/puppet/lib/puppet/indirector/indirection.rb +17 -9
  53. data/vendored/puppet/lib/puppet/indirector/ldap.rb +2 -2
  54. data/vendored/puppet/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
  55. data/vendored/puppet/lib/puppet/indirector/rest.rb +2 -1
  56. data/vendored/puppet/lib/puppet/indirector/ssl_file.rb +2 -2
  57. data/vendored/puppet/lib/puppet/indirector/terminus.rb +3 -3
  58. data/vendored/puppet/lib/puppet/interface.rb +1 -1
  59. data/vendored/puppet/lib/puppet/interface/action.rb +41 -24
  60. data/vendored/puppet/lib/puppet/interface/action_builder.rb +14 -5
  61. data/vendored/puppet/lib/puppet/interface/action_manager.rb +1 -1
  62. data/vendored/puppet/lib/puppet/interface/documentation.rb +21 -10
  63. data/vendored/puppet/lib/puppet/interface/face_collection.rb +4 -2
  64. data/vendored/puppet/lib/puppet/interface/option.rb +36 -15
  65. data/vendored/puppet/lib/puppet/interface/option_builder.rb +23 -9
  66. data/vendored/puppet/lib/puppet/interface/option_manager.rb +8 -3
  67. data/vendored/puppet/lib/puppet/metatype/manager.rb +7 -3
  68. data/vendored/puppet/lib/puppet/module.rb +2 -1
  69. data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +4 -0
  70. data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +3 -0
  71. data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +3 -0
  72. data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +3 -0
  73. data/vendored/puppet/lib/puppet/module_tool/errors/shared.rb +3 -3
  74. data/vendored/puppet/lib/puppet/network/auth_config_parser.rb +10 -5
  75. data/vendored/puppet/lib/puppet/network/authstore.rb +2 -2
  76. data/vendored/puppet/lib/puppet/network/client_request.rb +1 -1
  77. data/vendored/puppet/lib/puppet/network/format.rb +3 -3
  78. data/vendored/puppet/lib/puppet/network/http/api/indirection_type.rb +1 -1
  79. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
  80. data/vendored/puppet/lib/puppet/network/http/webrick.rb +1 -3
  81. data/vendored/puppet/lib/puppet/node.rb +16 -7
  82. data/vendored/puppet/lib/puppet/parameter.rb +3 -3
  83. data/vendored/puppet/lib/puppet/parameter/value_collection.rb +5 -2
  84. data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +1 -1
  85. data/vendored/puppet/lib/puppet/parser/ast/node.rb +2 -2
  86. data/vendored/puppet/lib/puppet/parser/compiler.rb +6 -5
  87. data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
  88. data/vendored/puppet/lib/puppet/parser/functions/fqdn_rand.rb +6 -2
  89. data/vendored/puppet/lib/puppet/parser/functions/generate.rb +2 -4
  90. data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -2
  91. data/vendored/puppet/lib/puppet/parser/functions/sha256.rb +5 -0
  92. data/vendored/puppet/lib/puppet/parser/functions/template.rb +6 -2
  93. data/vendored/puppet/lib/puppet/parser/resource.rb +18 -91
  94. data/vendored/puppet/lib/puppet/parser/scope.rb +12 -11
  95. data/vendored/puppet/lib/puppet/parser/templatewrapper.rb +1 -1
  96. data/vendored/puppet/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
  97. data/vendored/puppet/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
  98. data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
  99. data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
  100. data/vendored/puppet/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
  101. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
  102. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
  103. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +5 -6
  104. data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +1 -1
  105. data/vendored/puppet/lib/puppet/pops/functions/function.rb +8 -2
  106. data/vendored/puppet/lib/puppet/pops/issue_reporter.rb +7 -2
  107. data/vendored/puppet/lib/puppet/pops/issues.rb +14 -4
  108. data/vendored/puppet/lib/puppet/pops/label_provider.rb +1 -1
  109. data/vendored/puppet/lib/puppet/pops/loader/base_loader.rb +2 -2
  110. data/vendored/puppet/lib/puppet/pops/loader/dependency_loader.rb +2 -2
  111. data/vendored/puppet/lib/puppet/pops/loader/loader.rb +6 -1
  112. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
  113. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +27 -6
  114. data/vendored/puppet/lib/puppet/pops/loader/runtime3_type_loader.rb +2 -2
  115. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +1 -1
  116. data/vendored/puppet/lib/puppet/pops/loaders.rb +7 -3
  117. data/vendored/puppet/lib/puppet/pops/lookup/explainer.rb +2 -1
  118. data/vendored/puppet/lib/puppet/pops/merge_strategy.rb +6 -3
  119. data/vendored/puppet/lib/puppet/pops/migration/migration_checker.rb +8 -8
  120. data/vendored/puppet/lib/puppet/pops/model/factory.rb +4 -2
  121. data/vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  122. data/vendored/puppet/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
  123. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +6 -2
  124. data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +36 -15
  125. data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +2 -1
  126. data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +3 -1
  127. data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +4 -1
  128. data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +75 -7
  129. data/vendored/puppet/lib/puppet/pops/types/types.rb +9 -5
  130. data/vendored/puppet/lib/puppet/pops/validation.rb +14 -12
  131. data/vendored/puppet/lib/puppet/property.rb +14 -6
  132. data/vendored/puppet/lib/puppet/property/ensure.rb +2 -2
  133. data/vendored/puppet/lib/puppet/provider.rb +4 -4
  134. data/vendored/puppet/lib/puppet/provider/group/aix.rb +4 -2
  135. data/vendored/puppet/lib/puppet/provider/group/groupadd.rb +25 -1
  136. data/vendored/puppet/lib/puppet/provider/ldap.rb +2 -2
  137. data/vendored/puppet/lib/puppet/provider/naginator.rb +1 -1
  138. data/vendored/puppet/lib/puppet/provider/nameservice.rb +7 -4
  139. data/vendored/puppet/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
  140. data/vendored/puppet/lib/puppet/provider/nameservice/objectadd.rb +13 -24
  141. data/vendored/puppet/lib/puppet/provider/nameservice/pw.rb +14 -14
  142. data/vendored/puppet/lib/puppet/provider/package/aix.rb +1 -1
  143. data/vendored/puppet/lib/puppet/provider/package/pkg.rb +3 -2
  144. data/vendored/puppet/lib/puppet/provider/package/yum.rb +1 -1
  145. data/vendored/puppet/lib/puppet/provider/parsedfile.rb +4 -4
  146. data/vendored/puppet/lib/puppet/provider/service/base.rb +1 -1
  147. data/vendored/puppet/lib/puppet/provider/service/launchd.rb +2 -2
  148. data/vendored/puppet/lib/puppet/provider/service/runit.rb +2 -1
  149. data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -0
  150. data/vendored/puppet/lib/puppet/provider/service/upstart.rb +1 -1
  151. data/vendored/puppet/lib/puppet/provider/user/aix.rb +13 -6
  152. data/vendored/puppet/lib/puppet/provider/user/openbsd.rb +2 -1
  153. data/vendored/puppet/lib/puppet/provider/user/useradd.rb +33 -4
  154. data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +2 -1
  155. data/vendored/puppet/lib/puppet/provider/zone/solaris.rb +2 -2
  156. data/vendored/puppet/lib/puppet/relationship.rb +2 -1
  157. data/vendored/puppet/lib/puppet/reports/store.rb +1 -1
  158. data/vendored/puppet/lib/puppet/resource.rb +7 -5
  159. data/vendored/puppet/lib/puppet/resource/capability_finder.rb +14 -11
  160. data/vendored/puppet/lib/puppet/resource/catalog.rb +33 -18
  161. data/vendored/puppet/lib/puppet/resource/type.rb +5 -5
  162. data/vendored/puppet/lib/puppet/settings.rb +19 -13
  163. data/vendored/puppet/lib/puppet/settings/base_setting.rb +23 -8
  164. data/vendored/puppet/lib/puppet/settings/config_file.rb +14 -4
  165. data/vendored/puppet/lib/puppet/settings/environment_conf.rb +5 -7
  166. data/vendored/puppet/lib/puppet/settings/ini_file.rb +4 -0
  167. data/vendored/puppet/lib/puppet/ssl/base.rb +9 -4
  168. data/vendored/puppet/lib/puppet/ssl/oids.rb +8 -2
  169. data/vendored/puppet/lib/puppet/transaction.rb +6 -2
  170. data/vendored/puppet/lib/puppet/transaction/persistence.rb +15 -0
  171. data/vendored/puppet/lib/puppet/transaction/report.rb +9 -1
  172. data/vendored/puppet/lib/puppet/type.rb +26 -26
  173. data/vendored/puppet/lib/puppet/type/file.rb +2 -1
  174. data/vendored/puppet/lib/puppet/type/file/data_sync.rb +2 -1
  175. data/vendored/puppet/lib/puppet/type/file/source.rb +1 -1
  176. data/vendored/puppet/lib/puppet/type/group.rb +4 -1
  177. data/vendored/puppet/lib/puppet/type/mount.rb +1 -1
  178. data/vendored/puppet/lib/puppet/type/resources.rb +1 -1
  179. data/vendored/puppet/lib/puppet/type/user.rb +12 -7
  180. data/vendored/puppet/lib/puppet/type/zone.rb +1 -1
  181. data/vendored/puppet/lib/puppet/util.rb +15 -21
  182. data/vendored/puppet/lib/puppet/util/at_fork/solaris.rb +6 -4
  183. data/vendored/puppet/lib/puppet/util/command_line/trollop.rb +6 -5
  184. data/vendored/puppet/lib/puppet/util/errors.rb +59 -8
  185. data/vendored/puppet/lib/puppet/util/fileparsing.rb +3 -5
  186. data/vendored/puppet/lib/puppet/util/http_proxy.rb +14 -6
  187. data/vendored/puppet/lib/puppet/util/instance_loader.rb +1 -3
  188. data/vendored/puppet/lib/puppet/util/ldap/manager.rb +6 -3
  189. data/vendored/puppet/lib/puppet/util/log.rb +15 -21
  190. data/vendored/puppet/lib/puppet/util/logging.rb +21 -28
  191. data/vendored/puppet/lib/puppet/util/methodhelper.rb +1 -1
  192. data/vendored/puppet/lib/puppet/util/nagios_maker.rb +1 -1
  193. data/vendored/puppet/lib/puppet/util/network_device/config.rb +20 -13
  194. data/vendored/puppet/lib/puppet/util/platform.rb +13 -0
  195. data/vendored/puppet/lib/puppet/util/posix.rb +1 -1
  196. data/vendored/puppet/lib/puppet/util/provider_features.rb +1 -1
  197. data/vendored/puppet/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
  198. data/vendored/puppet/lib/puppet/util/selinux.rb +1 -1
  199. data/vendored/puppet/lib/puppet/util/windows/eventlog.rb +10 -5
  200. data/vendored/puppet/lib/puppet/util/windows/file.rb +61 -9
  201. data/vendored/puppet/lib/puppet/util/windows/process.rb +1 -1
  202. data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +2 -2
  203. data/vendored/puppet/lib/puppet/version.rb +1 -1
  204. data/vendored/puppet/lib/puppet_pal.rb +23 -22
  205. metadata +4 -2
@@ -40,12 +40,17 @@ class Puppet::Interface::OptionBuilder
40
40
  # @api public
41
41
  # @dsl Faces
42
42
  def before_action(&block)
43
- block or raise ArgumentError, "#{@option} before_action requires a block"
43
+ unless block
44
+ #TRANSLATORS 'before_action' is a method name and should not be translated
45
+ raise ArgumentError, _("%{option} before_action requires a block") % { option: @option }
46
+ end
44
47
  if @option.before_action
45
- raise ArgumentError, "#{@option} already has a before_action set"
48
+ #TRANSLATORS 'before_action' is a method name and should not be translated
49
+ raise ArgumentError, _("%{option} already has a before_action set") % { option: @option }
46
50
  end
47
51
  unless block.arity == 3 then
48
- raise ArgumentError, "before_action takes three arguments, action, args, and options"
52
+ #TRANSLATORS 'before_action' is a method name and should not be translated
53
+ raise ArgumentError, _("before_action takes three arguments, action, args, and options")
49
54
  end
50
55
  @option.before_action = block
51
56
  end
@@ -55,12 +60,17 @@ class Puppet::Interface::OptionBuilder
55
60
  # @api public
56
61
  # @dsl Faces
57
62
  def after_action(&block)
58
- block or raise ArgumentError, "#{@option} after_action requires a block"
63
+ unless block
64
+ #TRANSLATORS 'after_action' is a method name and should not be translated
65
+ raise ArgumentError, _("%{option} after_action requires a block") % { option: @option }
66
+ end
59
67
  if @option.after_action
60
- raise ArgumentError, "#{@option} already has an after_action set"
68
+ #TRANSLATORS 'after_action' is a method name and should not be translated
69
+ raise ArgumentError, _("%{option} already has an after_action set") % { option: @option }
61
70
  end
62
71
  unless block.arity == 3 then
63
- raise ArgumentError, "after_action takes three arguments, action, args, and options"
72
+ #TRANSLATORS 'after_action' is a method name and should not be translated
73
+ raise ArgumentError, _("after_action takes three arguments, action, args, and options")
64
74
  end
65
75
  @option.after_action = block
66
76
  end
@@ -79,12 +89,16 @@ class Puppet::Interface::OptionBuilder
79
89
  # @api public
80
90
  # @dsl Faces
81
91
  def default_to(&block)
82
- block or raise ArgumentError, "#{@option} default_to requires a block"
92
+ unless block
93
+ #TRANSLATORS 'default_to' is a method name and should not be translated
94
+ raise ArgumentError, _("%{option} default_to requires a block") % { option: @option }
95
+ end
83
96
  if @option.has_default?
84
- raise ArgumentError, "#{@option} already has a default value"
97
+ raise ArgumentError, _("%{option} already has a default value") % { option: @option }
85
98
  end
86
99
  unless block.arity == 0
87
- raise ArgumentError, "#{@option} default_to block should not take any arguments"
100
+ #TRANSLATORS 'default_to' is a method name and should not be translated
101
+ raise ArgumentError, _("%{option} default_to block should not take any arguments") % { option: @option }
88
102
  end
89
103
  @option.default = block
90
104
  end
@@ -9,7 +9,10 @@ module Puppet::Interface::OptionManager
9
9
  def display_global_options(*args)
10
10
  @display_global_options ||= []
11
11
  [args].flatten.each do |refopt|
12
- raise ArgumentError, "Global option #{refopt} does not exist in Puppet.settings" unless Puppet.settings.include? refopt
12
+ unless Puppet.settings.include?(refopt)
13
+ #TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated
14
+ raise ArgumentError, _("Global option %{option} does not exist in Puppet.settings") % { option: refopt }
15
+ end
13
16
  @display_global_options << refopt if refopt
14
17
  end
15
18
  @display_global_options.uniq!
@@ -51,13 +54,15 @@ module Puppet::Interface::OptionManager
51
54
 
52
55
  option.aliases.each do |name|
53
56
  if conflict = get_option(name) then
54
- raise ArgumentError, "Option #{option} conflicts with existing option #{conflict}"
57
+ raise ArgumentError, _("Option %{option} conflicts with existing option %{conflict}") %
58
+ { option: option, conflict: conflict }
55
59
  end
56
60
 
57
61
  actions.each do |action|
58
62
  action = get_action(action)
59
63
  if conflict = action.get_option(name) then
60
- raise ArgumentError, "Option #{option} conflicts with existing option #{conflict} on #{action}"
64
+ raise ArgumentError, _("Option %{option} conflicts with existing option %{conflict} on %{action}") %
65
+ { option: option, conflict: conflict, action: action }
61
66
  end
62
67
  end
63
68
  end
@@ -72,7 +72,9 @@ module Manager
72
72
  def newtype(name, options = {}, &block)
73
73
  # Handle backward compatibility
74
74
  unless options.is_a?(Hash)
75
- Puppet.warning "Puppet::Type.newtype(#{name}) now expects a hash as the second argument, not #{options.inspect}"
75
+ #TRANSLATORS 'Puppet::Type.newtype' should not be translated
76
+ Puppet.warning(_("Puppet::Type.newtype(%{name}) now expects a hash as the second argument, not %{argument}") %
77
+ { name: name, argument: options.inspect})
76
78
  end
77
79
 
78
80
  # First make sure we don't have a method sitting around
@@ -107,7 +109,8 @@ module Manager
107
109
  # Now define a "new<type>" method for convenience.
108
110
  if self.respond_to? newmethod
109
111
  # Refuse to overwrite existing methods like 'newparam' or 'newtype'.
110
- Puppet.warning "'new#{name.to_s}' method already exists; skipping"
112
+ #TRANSLATORS 'new%{method}' will become a method name, do not translate this string
113
+ Puppet.warning(_("'new%{method}' method already exists; skipping") % { method: name.to_s })
111
114
  else
112
115
  selfobj.send(:define_method, newmethod) do |*args|
113
116
  klass.new(*args)
@@ -169,7 +172,8 @@ module Manager
169
172
  end
170
173
  # Try loading the type.
171
174
  if typeloader.load(name, Puppet.lookup(:current_environment))
172
- Puppet.warning "Loaded puppet/type/#{name} but no class was created" unless @types.include? name
175
+ #TRANSLATORS 'puppet/type/%{name}' should not be translated
176
+ Puppet.warning(_("Loaded puppet/type/%{name} but no class was created") % { name: name }) unless @types.include? name
173
177
  elsif !Puppet[:always_retry_plugins]
174
178
  # PUP-5482 - Only look for a type once if plugin retry is disabled
175
179
  @types[name] = nil
@@ -206,7 +206,8 @@ class Puppet::Module
206
206
  rescue Errno::ENOENT
207
207
  {}
208
208
  rescue JSON::JSONError => e
209
- msg = "#{name} has an invalid and unparsable metadata.json file. The parse error: #{e.message}"
209
+ #TRANSLATORS 'metadata.json' is a specific file name and should not be translated.
210
+ msg = _("%{name} has an invalid and unparsable metadata.json file. The parse error: %{error}") % { name: name, error: e.message }
210
211
  case Puppet[:strict]
211
212
  when :off
212
213
  Puppet.debug(msg)
@@ -2,6 +2,7 @@ require 'fileutils'
2
2
  require 'json'
3
3
  require 'puppet/file_system'
4
4
  require 'pathspec'
5
+ require 'facter'
5
6
 
6
7
  module Puppet::ModuleTool
7
8
  module Applications
@@ -14,6 +15,9 @@ module Puppet::ModuleTool
14
15
  end
15
16
 
16
17
  def run
18
+ # Disallow anything that invokes md5 to avoid un-friendly termination due to FIPS
19
+ raise _("Module building is prohibited in FIPS mode.") if Facter.value(:fips_enabled)
20
+
17
21
  load_metadata!
18
22
  create_directory
19
23
  copy_contents
@@ -52,6 +52,9 @@ module Puppet::ModuleTool
52
52
  end
53
53
 
54
54
  def run
55
+ # Disallow anything that invokes md5 to avoid un-friendly termination due to FIPS
56
+ raise _("Module install is prohibited in FIPS mode.") if Facter.value(:fips_enabled)
57
+
55
58
  name = @name.tr('/', '-')
56
59
  version = options[:version] || '>= 0.0.0'
57
60
 
@@ -16,6 +16,9 @@ module Puppet::ModuleTool
16
16
  end
17
17
 
18
18
  def run
19
+ # Disallow anything that invokes md5 to avoid un-friendly termination due to FIPS
20
+ raise _("Module uninstall is prohibited in FIPS mode.") if Facter.value(:fips_enabled)
21
+
19
22
  results = {
20
23
  :module_name => @name,
21
24
  :requested_version => @version,
@@ -27,6 +27,9 @@ module Puppet::ModuleTool
27
27
  end
28
28
 
29
29
  def run
30
+ # Disallow anything that invokes md5 to avoid un-friendly termination due to FIPS
31
+ raise _("Module upgrade is prohibited in FIPS mode.") if Facter.value(:fips_enabled)
32
+
30
33
  name = @name.tr('/', '-')
31
34
  version = options[:version] || '>= 0.0.0'
32
35
 
@@ -98,11 +98,11 @@ module Puppet::ModuleTool::Errors
98
98
  def multiline
99
99
  dependency_list = []
100
100
  dependency_list << _("You specified '%{name}' (%{version})") % { name: @source.first[:name], version: v(@requested_version) }
101
- dependency_list = @source[1..-1].map do |m|
101
+ dependency_list += @source[1..-1].map do |m|
102
102
  #TRANSLATORS This message repeats as separate lines as a list under the heading "You specified '%{name}' (%{version})\n"
103
- _("which depends on '%{name}' (%{version})") % { name: m[:name], version: v(m[:version]) }
103
+ _("This depends on '%{name}' (%{version})") % { name: m[:name], version: v(m[:version]) }
104
104
  end
105
- message = []
105
+ message = []
106
106
  message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: v(@requested_version) }
107
107
  message << _(" No version of '%{module_name}' will satisfy dependencies") % { module_name: @module_name }
108
108
  message << dependency_list.map {|s| " #{s}".join(",\n")}
@@ -29,11 +29,14 @@ class AuthConfigParser
29
29
  when /^\s*(allow(?:_ip)?|deny(?:_ip)?|method|environment|auth(?:enticated)?)\s+(.+?)(\s*#.*)?$/
30
30
  if right.nil?
31
31
  #TRANSLATORS "path" is a configuration file entry and should not be translated
32
- raise Puppet::ConfigurationError, _("Missing or invalid 'path' before right directive at line %{count} of %{file}") % { count: count, file: @file }
32
+ raise Puppet::ConfigurationError, _("Missing or invalid 'path' before right directive at %{error_location}") %
33
+ { error_location: Puppet::Util::Errors.error_location(@file, count) }
33
34
  end
34
35
  parse_right_directive(right, $1, $2, count)
35
36
  else
36
- raise Puppet::ConfigurationError, _("Invalid line %{count}: %{line}") % { count: count, line: line }
37
+ error_location_str = Puppet::Util::Errors.error_location(nil, count)
38
+ raise Puppet::ConfigurationError, _("Invalid entry at %{error_location}: %{file_text}") %
39
+ { error_location: error_location_str, file_text: line }
37
40
  end
38
41
  count += 1
39
42
  }
@@ -65,8 +68,9 @@ class AuthConfigParser
65
68
  when /auth(?:enticated)?/
66
69
  modify_right(right, :restrict_authenticated, value, _("adding authentication %{value}"), count)
67
70
  else
68
- raise Puppet::ConfigurationError,
69
- _("Invalid argument '%{var}' at line %{count}") % { var: var, count: count }
71
+ error_location_str = Puppet::Util::Errors.error_location(nil, count)
72
+ raise Puppet::ConfigurationError, _("Invalid argument '%{var}' at %{error_location}") %
73
+ { var: var, error_location: error_location_str }
70
74
  end
71
75
  end
72
76
 
@@ -77,7 +81,8 @@ class AuthConfigParser
77
81
  right.info msg % { value: val }
78
82
  right.send(method, val)
79
83
  rescue Puppet::AuthStoreError => detail
80
- raise Puppet::ConfigurationError, _("%{detail} at line %{count} of %{file}") % { detail: detail, count: count, file: @file }, detail.backtrace
84
+ error_location_str = Puppet::Util::Errors.error_location(@file, count)
85
+ raise Puppet::ConfigurationError, "#{detail} #{error_location_str}", detail.backtrace
81
86
  end
82
87
  end
83
88
  end
@@ -19,7 +19,7 @@ module Puppet
19
19
  # This is probably unnecessary, and can cause some weirdnesses in
20
20
  # cases where we're operating over localhost but don't have a real
21
21
  # IP defined.
22
- raise Puppet::DevError, "Name and IP must be passed to 'allowed?'" unless name and ip
22
+ raise Puppet::DevError, _("Name and IP must be passed to 'allowed?'") unless name and ip
23
23
  # else, we're networked and such
24
24
  else
25
25
  # we're local
@@ -186,7 +186,7 @@ module Puppet
186
186
  # Set the declaration type. Either :allow or :deny.
187
187
  def type=(type)
188
188
  type = type.intern
189
- raise ArgumentError, "Invalid declaration type #{type}" unless VALID_TYPES.include?(type)
189
+ raise ArgumentError, _("Invalid declaration type %{type}") % { type: type } unless VALID_TYPES.include?(type)
190
190
  @type = type
191
191
  end
192
192
 
@@ -12,7 +12,7 @@ module Puppet::Network # :nodoc:
12
12
  # are responsible for setting the values correctly, but this common
13
13
  # format makes it possible to check rights.
14
14
  def call
15
- raise ArgumentError, "Request is not set up; cannot build call" unless handler and method
15
+ raise ArgumentError, _("Request is not set up; cannot build call") unless handler and method
16
16
 
17
17
  [handler, method].join(".")
18
18
  end
@@ -40,7 +40,7 @@ class Puppet::Network::Format
40
40
  init_attribute(method, value)
41
41
  end
42
42
 
43
- raise ArgumentError, "Unsupported option(s) #{@options.keys}" unless @options.empty?
43
+ raise ArgumentError, _("Unsupported option(s) %{options_list}") % { options_list: @options.keys } unless @options.empty?
44
44
 
45
45
  @options = nil
46
46
 
@@ -69,8 +69,8 @@ class Puppet::Network::Format
69
69
  def render_multiple(instances)
70
70
  # This method implicitly assumes that all instances are of the same type.
71
71
  return instances[0].class.send(render_multiple_method, instances) if instances[0].class.respond_to?(render_multiple_method)
72
- raise NotImplementedError, _("%{klass} does not respond to %{method}; can not render multiple instances to %{mime}") \
73
- % { klass: instances[0].class, method: render_multiple_method, mime: mime }
72
+ raise NotImplementedError, _("%{klass} does not respond to %{method}; can not render multiple instances to %{mime}") %
73
+ { klass: instances[0].class, method: render_multiple_method, mime: mime }
74
74
  end
75
75
 
76
76
  def required_methods_present?(klass)
@@ -26,7 +26,7 @@ class Puppet::Network::HTTP::API::IndirectionType
26
26
  when :master
27
27
  master_url_prefix
28
28
  else
29
- raise ArgumentError, "Not a valid indirection type"
29
+ raise ArgumentError, _("Not a valid indirection type")
30
30
  end
31
31
  end
32
32
  end
@@ -36,12 +36,15 @@ class Puppet::Network::HTTP::API::Master::V3::Environment
36
36
 
37
37
  nonexistent_components = mapped_components - required_components
38
38
  if nonexistent_components.any?
39
- raise Puppet::ParseError.new("Application #{app} assigns nodes to non-existent components: #{nonexistent_components.join(', ')}", file, line)
39
+ raise Puppet::ParseError.new(
40
+ _("Application %{application} assigns nodes to non-existent components: %{component_list}") %
41
+ { application: app, component_list: nonexistent_components.join(', ') }, file, line)
40
42
  end
41
43
 
42
44
  missing_components = required_components - mapped_components
43
45
  if missing_components.any?
44
- raise Puppet::ParseError.new("Application #{app} has components without assigned nodes: #{missing_components.join(', ')}", file, line)
46
+ raise Puppet::ParseError.new(_("Application %{application} has components without assigned nodes: %{component_list}") %
47
+ { application: app, component_list: missing_components.join(', ') }, file, line)
45
48
  end
46
49
 
47
50
  # Turn the 'nodes' hash into a map component ref => node name
@@ -17,8 +17,6 @@ class Puppet::Network::HTTP::WEBrick
17
17
  def listen(address, port)
18
18
  @server = create_server(address, port)
19
19
 
20
- @server.listeners.each { |l| l.start_immediately = false }
21
-
22
20
  @server.mount('/', Puppet::Network::HTTP::WEBrickREST)
23
21
 
24
22
  raise _("WEBrick server is already listening") if @listening
@@ -102,7 +100,7 @@ class Puppet::Network::HTTP::WEBrick
102
100
 
103
101
  results[:SSLPrivateKey] = host.key.content
104
102
  results[:SSLCertificate] = host.certificate.content
105
- results[:SSLStartImmediately] = true
103
+ results[:SSLStartImmediately] = false
106
104
  results[:SSLEnable] = true
107
105
  results[:SSLOptions] = OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
108
106
 
@@ -27,10 +27,10 @@ class Puppet::Node
27
27
  @name = data['name'] || (raise ArgumentError, _("No name provided in serialized data"))
28
28
  @classes = data['classes'] || []
29
29
  @parameters = data['parameters'] || {}
30
- env_name = data['environment']
30
+ env_name = data['environment'] || @parameters[ENVIRONMENT]
31
31
  env_name = env_name.intern unless env_name.nil?
32
32
  @environment_name = env_name
33
- environment = env_name # rubocop:disable Lint/UselessAssignment
33
+ self.environment = env_name
34
34
  end
35
35
 
36
36
  def self.from_data_hash(data)
@@ -45,10 +45,17 @@ class Puppet::Node
45
45
  'environment' => environment.name.to_s,
46
46
  }
47
47
  result['classes'] = classes unless classes.empty?
48
- result['parameters'] = parameters unless parameters.empty?
48
+ serialized_params = self.serializable_parameters
49
+ result['parameters'] = serialized_params unless serialized_params.empty?
49
50
  result
50
51
  end
51
52
 
53
+ def serializable_parameters
54
+ new_params = parameters.dup
55
+ new_params.delete(ENVIRONMENT)
56
+ new_params
57
+ end
58
+
52
59
  def environment
53
60
  if @environment
54
61
  @environment
@@ -60,7 +67,7 @@ class Puppet::Node
60
67
  else
61
68
  # This should not be :current_environment, this is the default
62
69
  # for a node when it has not specified its environment
63
- # Tt will be used to establish what the current environment is.
70
+ # it will be used to establish what the current environment is.
64
71
  #
65
72
  self.environment = Puppet.lookup(:environments).get!(Puppet[:environment])
66
73
  end
@@ -78,7 +85,8 @@ class Puppet::Node
78
85
 
79
86
  # Keep environment_name attribute and parameter in sync if they have been set
80
87
  unless @environment.nil?
81
- @parameters[ENVIRONMENT] = @environment.name.to_s if @parameters.include?(ENVIRONMENT)
88
+ # always set the environment parameter. It becomes top scope $environment for a manifest during catalog compilation.
89
+ @parameters[ENVIRONMENT] = @environment.name.to_s
82
90
  self.environment_name = @environment.name if instance_variable_defined?(:@environment_name)
83
91
  end
84
92
  @environment
@@ -132,7 +140,10 @@ class Puppet::Node
132
140
 
133
141
  if !@facts.nil?
134
142
  @facts.sanitize
143
+ # facts should never modify the environment parameter
144
+ orig_param_env = @parameters[ENVIRONMENT]
135
145
  merge(@facts.values)
146
+ @parameters[ENVIRONMENT] = orig_param_env
136
147
  end
137
148
  end
138
149
 
@@ -145,8 +156,6 @@ class Puppet::Node
145
156
  @parameters[name] = value
146
157
  end
147
158
  end
148
-
149
- @parameters[ENVIRONMENT] ||= self.environment.name.to_s
150
159
  end
151
160
 
152
161
  # Add extra facts, such as facts given to lookup on the command line The
@@ -338,7 +338,7 @@ class Puppet::Parameter
338
338
  self.resource = resource
339
339
  options.delete(:resource)
340
340
  else
341
- raise Puppet::DevError, "No resource set for #{self.class.name}"
341
+ raise Puppet::DevError, _("No resource set for %{name}") % { name: self.class.name }
342
342
  end
343
343
 
344
344
  set_options(options)
@@ -425,7 +425,7 @@ class Puppet::Parameter
425
425
  Puppet.debug "Reraising #{detail}"
426
426
  raise
427
427
  rescue => detail
428
- raise Puppet::DevError, "Munging failed for value #{value.inspect} in class #{self.name}: #{detail}", detail.backtrace
428
+ raise Puppet::DevError, _("Munging failed for value %{value} in class %{class_name}: %{detail}") % { value: value.inspect, class_name: self.name, detail: detail }, detail.backtrace
429
429
  end
430
430
  ret
431
431
  end
@@ -459,7 +459,7 @@ class Puppet::Parameter
459
459
  rescue Puppet::Error, TypeError
460
460
  raise
461
461
  rescue => detail
462
- raise Puppet::DevError, "Validate method failed for class #{self.name}: #{detail}", detail.backtrace
462
+ raise Puppet::DevError, _("Validate method failed for class %{class_name}: %{detail}") % { class_name: self.name, detail: detail }, detail.backtrace
463
463
  end
464
464
  end
465
465
 
@@ -19,7 +19,7 @@ class Puppet::Parameter::ValueCollection
19
19
  def aliasvalue(name, other)
20
20
  other = other.to_sym
21
21
  unless value = match?(other)
22
- raise Puppet::DevError, "Cannot alias nonexistent value #{other}"
22
+ raise Puppet::DevError, _("Cannot alias nonexistent value %{value}") % { value: other }
23
23
  end
24
24
 
25
25
  value.alias(name)
@@ -133,7 +133,10 @@ class Puppet::Parameter::ValueCollection
133
133
  call_opt = options[:call]
134
134
  unless call_opt.nil?
135
135
  devfail "Cannot use obsolete :call value '#{call_opt}' for property '#{self.class.name}'" unless call_opt == :none || call_opt == :instead
136
- Puppet.deprecation_warning(_("Property option :call is deprecated and no longer used. Please remove it."))
136
+ #TRANSLATORS ':call' is a property and should not be translated
137
+ message = _("Property option :call is deprecated and no longer used.")
138
+ message += ' ' + _("Please remove it.")
139
+ Puppet.deprecation_warning(message)
137
140
  options = options.reject { |k,v| k == :call }
138
141
  end
139
142