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
data/lib/bolt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bolt
2
- VERSION = '0.15.0'.freeze
2
+ VERSION = '0.16.0'.freeze
3
3
  end
@@ -42,7 +42,7 @@ Puppet::Functions.create_function(:run_command) do
42
42
  call_function('debug', "Simulating run_command('#{command}') - no targets given - no action taken")
43
43
  r = Bolt::ResultSet.new([])
44
44
  else
45
- r = executor.run_command(targets, command)
45
+ r = executor.run_command(targets, command, options.select { |k, _| k == '_run_as' })
46
46
  end
47
47
 
48
48
  if !r.ok && !options['_catch_errors']
@@ -22,13 +22,30 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
22
22
  )
23
23
  end
24
24
 
25
+ executor = Puppet.lookup(:bolt_executor) { nil }
26
+ unless executor && Puppet.features.bolt?
27
+ raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
28
+ Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a plan')
29
+ )
30
+ end
31
+
32
+ use_args = named_args.reject { |k, _| k.start_with?('_') }
33
+
25
34
  loaders = closure_scope.compiler.loaders
26
35
  # The perspective of the environment is wanted here (for now) to not have to
27
36
  # require modules to have dependencies defined in meta data.
28
37
  loader = loaders.private_environment_loader
29
38
  if loader && (func = loader.load(:plan, plan_name))
30
39
  # TODO: Add profiling around this
31
- return func.class.dispatcher.dispatchers[0].call_by_name_with_scope(scope, named_args, true)
40
+ if (run_as = named_args['_run_as'])
41
+ old_run_as = executor.run_as
42
+ executor.run_as = run_as
43
+ end
44
+ result = func.class.dispatcher.dispatchers[0].call_by_name_with_scope(scope, use_args, true)
45
+ if run_as
46
+ executor.run_as = old_run_as
47
+ end
48
+ return result
32
49
  end
33
50
  # Could not find plan
34
51
  raise ArgumentError, "Function #{self.class.name}(): Unknown plan: '#{plan_name}'"
@@ -50,7 +50,7 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
50
50
  r = if targets.empty?
51
51
  Bolt::ResultSet.new([])
52
52
  else
53
- executor.run_script(targets, found, options['arguments'] || [])
53
+ executor.run_script(targets, found, options['arguments'] || [], options.select { |k, _| k == '_run_as' })
54
54
  end
55
55
 
56
56
  if !r.ok && !options['_catch_errors']
@@ -87,7 +87,8 @@ Puppet::Functions.create_function(:run_task) do
87
87
  Bolt::ResultSet.new([])
88
88
  else
89
89
  # TODO: pass entire task to executor
90
- executor.run_task(targets, task.executable, task.input_method, use_args, &block)
90
+ options = task_args.select { |k, _| k == '_run_as' }
91
+ executor.run_task(targets, task.executable, task.input_method, use_args, options, &block)
91
92
  end
92
93
  end
93
94
  end
@@ -217,6 +217,8 @@ Facter.add("virtual") do
217
217
  result = "bochs"
218
218
  when /OpenStack/
219
219
  result = "openstack"
220
+ when /Google Compute Engine/
221
+ result = "gce"
220
222
  end
221
223
 
222
224
  if result.nil? and computersystem.manufacturer =~ /Xen/
@@ -29,7 +29,7 @@ class Hiera::Config
29
29
  if config
30
30
  version = config['version'] || config[:version] || 3
31
31
  if version >= 4
32
- raise "v4 hiera.yaml is only to be used inside an environment or a module and cannot be given to the global hiera"
32
+ raise "v#{version} hiera.yaml is only to be used inside an environment or a module and cannot be given to the global hiera"
33
33
  end
34
34
  @config.merge! config
35
35
  end
@@ -48,7 +48,7 @@ class Hiera::Config
48
48
  @config[:logger] = "console"
49
49
  Hiera.logger = "console"
50
50
  end
51
-
51
+
52
52
  self.validate!
53
53
 
54
54
  @config
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  class Hiera
10
- VERSION = "3.4.1"
10
+ VERSION = "3.4.2"
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -60,8 +60,11 @@ class Hiera::PuppetFunction < Puppet::Functions::InternalFunction
60
60
 
61
61
  def lookup(scope, key, default, has_default, override, &default_block)
62
62
  unless Puppet[:strict] == :off
63
- Puppet.warn_once('deprecations', self.class.name,
64
- "The function '#{self.class.name}' is deprecated in favor of using 'lookup'. See https://docs.puppet.com/puppet/#{Puppet.minor_version}/reference/deprecated_language.html")
63
+ #TRANSLATORS 'lookup' is a puppet function and should not be translated
64
+ message = _("The function '%{class_name}' is deprecated in favor of using 'lookup'.") % { class_name: self.class.name }
65
+ message += ' '+ _("See https://docs.puppet.com/puppet/%{minor_version}/reference/deprecated_language.html") %
66
+ { minor_version: Puppet.minor_version }
67
+ Puppet.warn_once('deprecations', self.class.name, message)
65
68
  end
66
69
  lookup_invocation = Puppet::Pops::Lookup::Invocation.new(scope, {}, {})
67
70
  adapter = lookup_invocation.lookup_adapter
@@ -11,7 +11,7 @@ module HieraPuppet
11
11
  answer = hiera.lookup(key, default, scope, override, resolution_type)
12
12
 
13
13
  if answer.nil?
14
- raise(Puppet::ParseError, "Could not find data item #{key} in any Hiera data file and no default supplied")
14
+ raise Puppet::ParseError, _("Could not find data item %{key} in any Hiera data file and no default supplied") % { key: key }
15
15
  end
16
16
 
17
17
  answer
@@ -38,7 +38,7 @@ module HieraPuppet
38
38
  end
39
39
 
40
40
  if args.empty?
41
- raise(Puppet::ParseError, "Please supply a parameter to perform a Hiera lookup")
41
+ raise Puppet::ParseError, _("Please supply a parameter to perform a Hiera lookup")
42
42
  end
43
43
 
44
44
  key = args[0]
@@ -71,7 +71,7 @@ module HieraPuppet
71
71
  if Puppet::FileSystem.exist?(hiera_config)
72
72
  hiera_config
73
73
  else
74
- Puppet.warning "Config file #{hiera_config} not found, using Hiera defaults"
74
+ Puppet.warning _("Config file %{hiera_config} not found, using Hiera defaults") % { hiera_config: hiera_config }
75
75
  nil
76
76
  end
77
77
  end
@@ -29,11 +29,12 @@ module Puppet::Agent::Locker
29
29
 
30
30
  # @deprecated
31
31
  def running?
32
- Puppet.deprecation_warning _(<<-ENDHEREDOC)
33
- Puppet::Agent::Locker.running? is deprecated as it is inherently unsafe.
34
- The only safe way to know if the lock is locked is to try lock and perform some
35
- action and then handle the LockError that may result.
36
- ENDHEREDOC
32
+ #TRANSLATORS 'Puppet::Agent::Locker.running?' is a method name and should not be translated
33
+ message = _('Puppet::Agent::Locker.running? is deprecated as it is inherently unsafe.')
34
+ #TRANSLATORS 'LockError' should not be translated
35
+ message += ' ' + _('The only safe way to know if the lock is locked is to try lock and perform some '\
36
+ 'action and then handle the LockError that may result.')
37
+ Puppet.deprecation_warning(message)
37
38
  lockfile.locked?
38
39
  end
39
40
 
@@ -84,8 +84,8 @@ configuration options can also be generated by running puppet with
84
84
  '--genconfig'.
85
85
 
86
86
  * --bucket:
87
- Specify a filebucket path. If '--local' is also set, this path
88
- overrides the default '--local' path set in '$clientbucketdir'.
87
+ Specify a local filebucket path. This overrides the default path
88
+ set in '$clientbucketdir'.
89
89
 
90
90
  * --debug:
91
91
  Enable full debugging.
@@ -119,35 +119,47 @@ configuration options can also be generated by running puppet with
119
119
  * --version:
120
120
  Print version information.
121
121
 
122
-
123
- EXAMPLE
124
- -------
122
+ EXAMPLES
123
+ --------
124
+ ## Backup a file to the filebucket, then restore it to a temporary directory
125
125
  $ puppet filebucket backup /etc/passwd
126
126
  /etc/passwd: 429b225650b912a2ee067b0a4cf1e949
127
127
  $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949
128
+
128
129
  ## Diff between two files in the filebucket
129
130
  $ puppet filebucket -l diff d43a6ecaa892a1962398ac9170ea9bf2 7ae322f5791217e031dc60188f4521ef
130
131
  1a2
131
132
  > again
132
- ## Diff between the file in the filebucket and the current one
133
+
134
+ ## Diff between the file in the filebucket and a local file
133
135
  $ puppet filebucket -l diff d43a6ecaa892a1962398ac9170ea9bf2 /tmp/testFile
134
136
  1a2
135
137
  > again
138
+
139
+ ## Backup a file to the filebucket and observe that it keeps each backup separate
136
140
  $ puppet filebucket -l list
137
141
  d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
142
+
138
143
  $ echo again >> /tmp/TestFile
144
+
139
145
  $ puppet filebucket -l backup /tmp/TestFile
140
146
  /tmp/TestFile: 7ae322f5791217e031dc60188f4521ef
147
+
141
148
  $ puppet filebucket -l list
142
149
  d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
143
150
  7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
151
+
152
+ ## List files in a filebucket within date ranges
144
153
  $ puppet filebucket -l -f 2015-01-01 -t 2015-01-11 list
145
154
  <Empty Output>
155
+
146
156
  $ puppet filebucket -l -f 2015-05-10 list
147
157
  d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
148
158
  7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
159
+
149
160
  $ puppet filebucket -l -f "2015-05-11 09:30:00" list
150
161
  7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
162
+
151
163
  $ puppet filebucket -l -t "2015-05-11 09:30:00" list
152
164
  d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
153
165
  ## Manage files in a specific local filebucket
@@ -156,6 +168,11 @@ EXAMPLE
156
168
  $ puppet filebucket -b /tmp/TestBucket list
157
169
  d41d8cd98f00b204e9800998ecf8427e 2015-05-11 09:33:22 /tmp/TestFile2
158
170
 
171
+ ## From a Puppet master, list files in the master bucketdir
172
+ $ puppet filebucket -b $(puppet config print bucketdir --section master) list
173
+ d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
174
+ 7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
175
+
159
176
  AUTHOR
160
177
  ------
161
178
  Luke Kanies
@@ -79,7 +79,7 @@ class Puppet::Daemon
79
79
  end
80
80
 
81
81
  def reexec
82
- raise Puppet::DevError, "Cannot reexec unless ARGV arguments are set" unless argv
82
+ raise Puppet::DevError, _("Cannot reexec unless ARGV arguments are set") unless argv
83
83
  command = $0 + " " + argv.join(" ")
84
84
  Puppet.notice "Restarting with '#{command}'"
85
85
  stop(:exit => false)
@@ -140,7 +140,7 @@ class Puppet::Daemon
140
140
  def start
141
141
  create_pidfile
142
142
 
143
- raise Puppet::DevError, "Daemons must have an agent, server, or both" unless agent or server
143
+ raise Puppet::DevError, _("Daemons must have an agent, server, or both") unless agent or server
144
144
 
145
145
  # Start the listening server, if required.
146
146
  server.start if server
@@ -1,3 +1,5 @@
1
+ require 'puppet/util/platform'
2
+
1
3
  module Puppet
2
4
 
3
5
  def self.default_diffargs
@@ -8,6 +10,22 @@ module Puppet
8
10
  end
9
11
  end
10
12
 
13
+ def self.default_digest_alg
14
+ if Puppet::Util::Platform.fips_enabled?
15
+ "sha256"
16
+ else
17
+ "md5"
18
+ end
19
+ end
20
+
21
+ def self.default_checksum_types
22
+ if Puppet::Util::Platform.fips_enabled?
23
+ ['sha256', 'sha384', 'sha512', 'sha224']
24
+ else
25
+ ['md5', 'sha256', 'sha384', 'sha512', 'sha224']
26
+ end
27
+ end
28
+
11
29
  ############################################################################################
12
30
  # NOTE: For information about the available values for the ":type" property of settings,
13
31
  # see the docs for Settings.define_settings
@@ -99,7 +117,8 @@ module Puppet
99
117
  valid = %w[deprecations undefined_variables undefined_resources]
100
118
  invalid = values - (values & valid)
101
119
  if not invalid.empty?
102
- raise ArgumentError, "Cannot disable unrecognized warning types #{invalid.inspect}. Valid values are #{valid.inspect}."
120
+ raise ArgumentError, _("Cannot disable unrecognized warning types %{invalid}.") % { invalid: invalid.inspect } +
121
+ ' ' + _("Valid values are %{values}.") % { values: valid.inspect}
103
122
  end
104
123
  end
105
124
  },
@@ -443,7 +462,11 @@ module Puppet
443
462
  if Puppet[:strict] != :off
444
463
  s_val = value.to_s # because sometimes the value is a symbol
445
464
  unless s_val == 'hiera' || s_val == 'none' || value == '' || value.nil?
446
- Puppet.deprecation_warning "Setting 'data_binding_terminus' is deprecated. Convert custom terminus to hiera 5 API."
465
+ #TRANSLATORS 'data_binding_terminus' is a setting and should not be translated
466
+ message = _("Setting 'data_binding_terminus' is deprecated.")
467
+ #TRANSLATORS 'hiera' should not be translated
468
+ message += ' ' + _("Convert custom terminus to hiera 5 API.")
469
+ Puppet.deprecation_warning(message)
447
470
  end
448
471
  end
449
472
  end
@@ -595,7 +618,8 @@ module Puppet
595
618
  custom data providers see the respective module documentation. This setting is deprecated.",
596
619
  :hook => proc { |value|
597
620
  unless value.nil? || Puppet[:strict] == :off
598
- Puppet.deprecation_warning "Setting 'environment_data_provider' is deprecated."
621
+ #TRANSLATORS 'environment_data_provider' is a setting and should not be translated
622
+ Puppet.deprecation_warning(_("Setting 'environment_data_provider' is deprecated."))
599
623
  end
600
624
  }
601
625
  },
@@ -697,7 +721,7 @@ module Puppet
697
721
  for a normal node.
698
722
 
699
723
  Defaults to the node's fully qualified domain name.",
700
- :hook => proc { |value| raise(ArgumentError, "Certificate names must be lower case") unless value == value.downcase }},
724
+ :hook => proc { |value| raise(ArgumentError, _("Certificate names must be lower case")) unless value == value.downcase }},
701
725
  :dns_alt_names => {
702
726
  :default => '',
703
727
  :desc => <<EOT,
@@ -915,14 +939,14 @@ attempt to download the CRL.
915
939
  EOT
916
940
  },
917
941
  :digest_algorithm => {
918
- :default => 'md5',
942
+ :default => lambda { default_digest_alg },
919
943
  :type => :enum,
920
944
  :values => ["md5", "sha256", "sha384", "sha512", "sha224"],
921
945
  :desc => 'Which digest algorithm to use for file resources and the filebucket.
922
946
  Valid values are md5, sha256, sha384, sha512, sha224. Default is md5.',
923
947
  },
924
948
  :supported_checksum_types => {
925
- :default => ['md5', 'sha256', 'sha384', 'sha512', 'sha224'],
949
+ :default => lambda { default_checksum_types },
926
950
  :type => :array,
927
951
  :desc => 'Checksum types supported by this agent for use in file resources of a
928
952
  static catalog. Values must be comma-separated. Valid types are md5,
@@ -933,7 +957,8 @@ EOT
933
957
  valid = ['md5', 'md5lite', 'sha256', 'sha256lite', 'sha384', 'sha512', 'sha224', 'sha1', 'sha1lite', 'mtime', 'ctime']
934
958
  invalid = values.reject {|alg| valid.include?(alg)}
935
959
  if not invalid.empty?
936
- raise ArgumentError, "Unrecognized checksum types #{invalid} are not supported. Valid values are #{valid}."
960
+ raise ArgumentError, _("Unrecognized checksum types %{invalid} are not supported.") % { invalid: invalid } +
961
+ ' ' + _("Valid values are %{values}.") % { values: valid }
937
962
  end
938
963
  end
939
964
  }
@@ -1456,7 +1481,10 @@ EOT
1456
1481
  :call_hook => :on_initialize_and_write,
1457
1482
  :hook => proc { |value|
1458
1483
  if Puppet.settings.set_by_config?(:server) && Puppet.settings.set_by_config?(:server_list)
1459
- Puppet.deprecation_warning('Attempted to set both server and server_list. Server setting will not be used.', :SERVER_DUPLICATION)
1484
+ #TRANSLATOR 'server' and 'server_list' are setting names and should not be translated
1485
+ message = _('Attempted to set both server and server_list.')
1486
+ message += ' ' + _('Server setting will not be used.')
1487
+ Puppet.deprecation_warning(message, :SERVER_DUPLICATION)
1460
1488
  end
1461
1489
  }
1462
1490
  },
@@ -1468,7 +1496,10 @@ EOT
1468
1496
  :call_hook => :on_initialize_and_write,
1469
1497
  :hook => proc { |value|
1470
1498
  if Puppet.settings.set_by_config?(:server) && Puppet.settings.set_by_config?(:server_list)
1471
- Puppet.deprecation_warning('Attempted to set both server and server_list. Server setting will not be used.', :SERVER_DUPLICATION)
1499
+ #TRANSLATOR 'server' and 'server_list' are setting names and should not be translated
1500
+ message = _('Attempted to set both server and server_list.')
1501
+ message += ' ' + _('Server setting will not be used.')
1502
+ Puppet.deprecation_warning(message, :SERVER_DUPLICATION)
1472
1503
  end
1473
1504
  }
1474
1505
  },
@@ -1776,7 +1807,8 @@ EOT
1776
1807
  :desc => "Whether plugins should be synced with the central server. This setting is
1777
1808
  deprecated.",
1778
1809
  :hook => proc { |value|
1779
- Puppet.deprecation_warning "Setting 'pluginsync' is deprecated."
1810
+ #TRANSLATORS 'pluginsync' is a setting and should not be translated
1811
+ Puppet.deprecation_warning(_("Setting 'pluginsync' is deprecated."))
1780
1812
  }
1781
1813
  },
1782
1814
  :pluginsignore => {
@@ -27,22 +27,12 @@ module Puppet
27
27
  @line = line
28
28
  @pos = pos
29
29
  end
30
+
30
31
  def to_s
31
32
  msg = super
32
33
  @file = nil if (@file.is_a?(String) && @file.empty?)
33
- if @file and @line and @pos
34
- "#{msg} at #{@file}:#{@line}:#{@pos}"
35
- elsif @file and @line
36
- "#{msg} at #{@file}:#{@line}"
37
- elsif @line and @pos
38
- "#{msg} at line #{@line}:#{@pos}"
39
- elsif @line
40
- "#{msg} at line #{@line}"
41
- elsif @file
42
- "#{msg} in #{@file}"
43
- else
44
- msg
45
- end
34
+ msg += Puppet::Util::Errors.error_location_with_space(@file, @line, @pos)
35
+ msg
46
36
  end
47
37
  end
48
38
 
@@ -74,8 +64,8 @@ module Puppet
74
64
 
75
65
  def to_s
76
66
  msg = super
77
- msg = "Could not parse for environment #{environment}: #{msg}" if environment
78
- msg = "#{msg} on node #{node}" if node
67
+ msg = _("Could not parse for environment %{environment}: %{message}") % { environment: environment, message: msg } if environment
68
+ msg = _("%{message} on node %{node}") % { message: msg, node: node } if node
79
69
  msg
80
70
  end
81
71
 
@@ -43,7 +43,7 @@ module PSON
43
43
  case
44
44
  when c.empty? then p
45
45
  when p.const_defined?(c) then p.const_get(c)
46
- else raise ArgumentError, "can't find const for unregistered document type #{path}"
46
+ else raise ArgumentError, _("can't find const for unregistered document type %{path}") % { path: path}
47
47
  end
48
48
  end
49
49
  end
@@ -308,7 +308,7 @@ module PSON
308
308
  result
309
309
  end
310
310
  rescue PSON::NestingError
311
- raise ArgumentError, "exceed depth limit", $!.backtrace
311
+ raise ArgumentError, _("exceed depth limit"), $!.backtrace
312
312
  end
313
313
 
314
314