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
@@ -59,7 +59,7 @@ class Puppet::Property::Ensure < Puppet::Property
59
59
  rescue Puppet::Error, Puppet::DevError
60
60
  raise
61
61
  rescue => detail
62
- raise Puppet::DevError, "Could not convert change #{self.name} to string: #{detail}", detail.backtrace
62
+ raise Puppet::DevError, _("Could not convert change %{name} to string: %{detail}") % { name: self.name, detail: detail }, detail.backtrace
63
63
  end
64
64
  end
65
65
 
@@ -82,7 +82,7 @@ class Puppet::Property::Ensure < Puppet::Property
82
82
  elsif @resource.respond_to?(:exists?)
83
83
  result = @resource.exists?
84
84
  else
85
- raise Puppet::DevError, "No ability to determine if #{@resource.class.name} exists"
85
+ raise Puppet::DevError, _("No ability to determine if %{name} exists") % { name: @resource.class.name }
86
86
  end
87
87
  if result
88
88
  return :present
@@ -143,7 +143,7 @@ class Puppet::Provider
143
143
  elsif superclass.respond_to? :command and command = superclass.command(name)
144
144
  # nothing
145
145
  else
146
- raise Puppet::DevError, "No command #{name} defined for provider #{self.name}"
146
+ raise Puppet::DevError, _("No command %{command} defined for provider %{provider}") % { command: name, provider: self.name }
147
147
  end
148
148
 
149
149
  which(command)
@@ -384,7 +384,7 @@ class Puppet::Provider
384
384
  # @raise [Puppet::DevError] Error indicating that the method should have been implemented by subclass.
385
385
  # @see prefetch
386
386
  def self.instances
387
- raise Puppet::DevError, "Provider #{self.name} has not defined the 'instances' class method"
387
+ raise Puppet::DevError, _("Provider %{provider} has not defined the 'instances' class method") % { provider: self.name }
388
388
  end
389
389
 
390
390
  # Creates getter- and setter- methods for each property supported by the resource type.
@@ -456,7 +456,7 @@ class Puppet::Provider
456
456
  klass = param
457
457
  else
458
458
  unless klass = resource_type.attrclass(param)
459
- raise Puppet::DevError, "'#{param}' is not a valid parameter for #{resource_type.name}"
459
+ raise Puppet::DevError, _("'%{parameter_name}' is not a valid parameter for %{resource_type}") % { parameter_name: param, resource_type: resource_type.name }
460
460
  end
461
461
  end
462
462
  return true unless features = klass.required_features
@@ -540,7 +540,7 @@ class Puppet::Provider
540
540
  elsif self.resource
541
541
  resource.name
542
542
  else
543
- raise Puppet::DevError, "No resource and no name in property hash in #{self.class.name} instance"
543
+ raise Puppet::DevError, _("No resource and no name in property hash in %{class_name} instance") % { class_name: self.class.name }
544
544
  end
545
545
  end
546
546
 
@@ -98,8 +98,10 @@ Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject d
98
98
  def get_arguments(key, value, mapping, objectinfo)
99
99
  # In the case of attributes, return a list of key=value
100
100
  if key == :attributes
101
- raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{resource}[%{name}]") % { resource: @resource.class.name, name: @resource.name } \
102
- unless value and value.is_a? Hash
101
+ unless value and value.is_a? Hash
102
+ raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{resource}[%{name}]") %
103
+ { resource: @resource.class.name, name: @resource.name }
104
+ end
103
105
  return value.select { |k,v| true }.map { |pair| pair.join("=") }
104
106
  end
105
107
  super(key, value, mapping, objectinfo)
@@ -14,7 +14,8 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
14
14
  value.is_a? Integer
15
15
  end
16
16
 
17
- optional_commands :localadd => "lgroupadd"
17
+ optional_commands :localadd => "lgroupadd", :localdelete => "lgroupdel", :localmodify => "lgroupmod"
18
+
18
19
  has_feature :libuser if Puppet.features.libuser?
19
20
 
20
21
  def exists?
@@ -82,4 +83,27 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
82
83
  cmd << @resource[:name]
83
84
  cmd
84
85
  end
86
+
87
+ def modifycmd(param, value)
88
+ if @resource.forcelocal?
89
+ cmd = [command(:localmodify)]
90
+ @custom_environment = Puppet::Util::Libuser.getenv
91
+ else
92
+ cmd = [command(:modify)]
93
+ end
94
+ cmd << flag(param) << value
95
+ cmd += check_allow_dup
96
+ cmd << @resource[:name]
97
+
98
+ cmd
99
+ end
100
+
101
+ def deletecmd
102
+ if @resource.forcelocal?
103
+ @custom_environment = Puppet::Util::Libuser.getenv
104
+ [command(:localdelete), @resource[:name]]
105
+ else
106
+ [command(:delete), @resource[:name]]
107
+ end
108
+ end
85
109
  end
@@ -74,8 +74,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
74
74
  end
75
75
 
76
76
  def initialize(*args)
77
- raise(Puppet::DevError, "No LDAP Configuration defined for #{self.class}") unless self.class.manager
78
- raise(Puppet::DevError, "Invalid LDAP Configuration defined for #{self.class}") unless self.class.manager.valid?
77
+ raise(Puppet::DevError, _("No LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager
78
+ raise(Puppet::DevError, _("Invalid LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager.valid?
79
79
  super
80
80
 
81
81
  @property_hash = @property_hash.inject({}) do |result, ary|
@@ -10,7 +10,7 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
10
10
  unless @nagios_type
11
11
  name = resource_type.name.to_s.sub(/^nagios_/, '')
12
12
  unless @nagios_type = Nagios::Base.type(name.to_sym)
13
- raise Puppet::DevError, "Could not find nagios type '#{name}'"
13
+ raise Puppet::DevError, _("Could not find nagios type '%{name}'") % { name: name }
14
14
  end
15
15
 
16
16
  # And add our 'ensure' settings, since they aren't a part of
@@ -41,7 +41,9 @@ class Puppet::Provider::NameService < Puppet::Provider
41
41
  end
42
42
 
43
43
  def options(name, hash)
44
- raise Puppet::DevError, "#{name} is not a valid attribute for #{resource_type.name}" unless resource_type.valid_parameter?(name)
44
+ unless resource_type.valid_parameter?(name)
45
+ raise Puppet::DevError, _("%{name} is not a valid attribute for %{resource_type}") % { name: name, resource_type: resource_type.name }
46
+ end
45
47
  @options ||= {}
46
48
  @options[name] ||= {}
47
49
 
@@ -115,7 +117,7 @@ class Puppet::Provider::NameService < Puppet::Provider
115
117
  end
116
118
 
117
119
  # Autogenerate a value. Mostly used for uid/gid, but also used heavily
118
- # with DirectoryServices, because DirectoryServices is stupid.
120
+ # with DirectoryServices
119
121
  def autogen(field)
120
122
  field = field.intern
121
123
  id_generators = {:user => :uid, :group => :gid}
@@ -141,7 +143,8 @@ class Puppet::Provider::NameService < Puppet::Provider
141
143
  when :user; database = :passwd; method = :uid
142
144
  when :group; database = :group; method = :gid
143
145
  else
144
- raise Puppet::DevError, "Invalid resource name #{resource}"
146
+ #TRANSLATORS "autogen_id()" is a method name and should not be translated
147
+ raise Puppet::DevError, _("autogen_id() does not support auto generation of id for resource type %{resource_type}") % { resource_type: resource_type }
145
148
  end
146
149
 
147
150
  # Initialize from the data set, if needed.
@@ -296,7 +299,7 @@ class Puppet::Provider::NameService < Puppet::Provider
296
299
  def set(param, value)
297
300
  self.class.validate(param, value)
298
301
  cmd = modifycmd(param, munge(param, value))
299
- raise Puppet::DevError, "Nameservice command must be an array" unless cmd.is_a?(Array)
302
+ raise Puppet::DevError, _("Nameservice command must be an array") unless cmd.is_a?(Array)
300
303
  begin
301
304
  execute(cmd)
302
305
  rescue Puppet::ExecutionFailure => detail
@@ -196,8 +196,9 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
196
196
  # zeroes. If someone attempts to use a password hash that worked with
197
197
  # a previous version of OS X, we will fail early and warn them.
198
198
  if password_hash.length != 136
199
- fail(_("OS X 10.7 requires a Salted SHA512 hash password of 136 characters. \
200
- Please check your password and try again."))
199
+ #TRANSLATORS 'OS X 10.7' is an operating system and should not be translated, 'Salted SHA512' is the name of a hashing algorithm
200
+ fail(_("OS X 10.7 requires a Salted SHA512 hash password of 136 characters.") +
201
+ ' ' + _("Please check your password and try again."))
201
202
  end
202
203
 
203
204
  plist_file = "#{users_plist_dir}/#{resource_name}.plist"
@@ -372,7 +373,7 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
372
373
  # expects to be returned by addcmd. Thus we don't bother defining addcmd.
373
374
  def create
374
375
  if exists?
375
- info "already exists"
376
+ info _("already exists")
376
377
  return nil
377
378
  end
378
379
 
@@ -1,33 +1,22 @@
1
1
  require 'puppet/provider/nameservice'
2
2
 
3
3
  class Puppet::Provider::NameService
4
- class ObjectAdd < Puppet::Provider::NameService
5
- def deletecmd
6
- [command(:delete), @resource[:name]]
7
- end
8
-
9
- # Determine the flag to pass to our command.
10
- def flag(name)
11
- name = name.intern if name.is_a? String
12
- self.class.option(name, :flag) || "-" + name.to_s[0,1]
13
- end
14
-
15
- def modifycmd(param, value)
16
- cmd = [command(param.to_s =~ /password_.+_age/ ? :password : :modify)]
17
- cmd << flag(param) << value
18
- if @resource.allowdupe? && ((param == :uid) || (param == :gid and self.class.name == :groupadd))
19
- cmd << "-o"
4
+ class ObjectAdd < Puppet::Provider::NameService
5
+ def deletecmd
6
+ [command(:delete), @resource[:name]]
20
7
  end
21
- cmd << @resource[:name]
22
8
 
23
- cmd
24
- end
9
+ # Determine the flag to pass to our command.
10
+ def flag(name)
11
+ name = name.intern if name.is_a? String
12
+ self.class.option(name, :flag) || "-" + name.to_s[0, 1]
13
+ end
25
14
 
26
- def posixmethod(name)
27
- name = name.intern if name.is_a? String
28
- method = self.class.option(name, :method) || name
15
+ def posixmethod(name)
16
+ name = name.intern if name.is_a? String
17
+ method = self.class.option(name, :method) || name
29
18
 
30
- method
19
+ method
20
+ end
31
21
  end
32
22
  end
33
- end
@@ -1,21 +1,21 @@
1
1
  require 'puppet/provider/nameservice/objectadd'
2
2
 
3
3
  class Puppet::Provider::NameService
4
- class PW < ObjectAdd
5
- def deletecmd
6
- [command(:pw), "#{@resource.class.name.to_s}del", @resource[:name]]
7
- end
4
+ class PW < ObjectAdd
5
+ def deletecmd
6
+ [command(:pw), "#{@resource.class.name.to_s}del", @resource[:name]]
7
+ end
8
8
 
9
- def modifycmd(param, value)
10
- cmd = [
11
- command(:pw),
12
- "#{@resource.class.name.to_s}mod",
13
- @resource[:name],
14
- flag(param),
15
- munge(param, value)
16
- ]
17
- cmd
9
+ def modifycmd(param, value)
10
+ cmd = [
11
+ command(:pw),
12
+ "#{@resource.class.name.to_s}mod",
13
+ @resource[:name],
14
+ flag(param),
15
+ munge(param, value)
16
+ ]
17
+ cmd
18
+ end
18
19
  end
19
20
  end
20
- end
21
21
 
@@ -136,7 +136,7 @@ Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package d
136
136
  unless upd.nil?
137
137
  return "#{upd[:version]}"
138
138
  else
139
- raise Puppet::DevError, "Tried to get latest on a missing package" if properties[:ensure] == :absent
139
+ raise Puppet::DevError, _("Tried to get latest on a missing package") if properties[:ensure] == :absent
140
140
 
141
141
  return properties[:ensure]
142
142
  end
@@ -163,7 +163,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
163
163
  return false
164
164
  end
165
165
  }
166
- raise Puppet::DevError, "No version of #{name} matching #{should} is installable, even though the package is currently installed"
166
+ raise Puppet::DevError, _("No version of %{name} matching %{should} is installable, even though the package is currently installed") %
167
+ { name: name, should: should }
167
168
  end
168
169
 
169
170
  false
@@ -181,7 +182,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
181
182
  # remove certificate expiration warnings from the output, but report them
182
183
  cert_warnings = lines.select { |line| line =~ /^Certificate/ }
183
184
  unless cert_warnings.empty?
184
- Puppet.warning("pkg warning: #{cert_warnings.join(', ')}")
185
+ Puppet.warning(_("pkg warning: %{warnings}") % { warnings: cert_warnings.join(', ') })
185
186
  end
186
187
 
187
188
  lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }
@@ -245,7 +245,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
245
245
  else
246
246
  # Yum didn't find updates, pretend the current version is the latest
247
247
  version = properties[:ensure]
248
- raise Puppet::DevError, "Tried to get latest on a missing package" if version == :absent || version == :purged
248
+ raise Puppet::DevError, _("Tried to get latest on a missing package") if version == :absent || version == :purged
249
249
  return version
250
250
  end
251
251
  end
@@ -43,7 +43,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
43
43
  elsif klass = Puppet::Util::FileType.filetype(type)
44
44
  @filetype = klass
45
45
  else
46
- raise ArgumentError, "Invalid filetype #{type}"
46
+ raise ArgumentError, _("Invalid filetype %{type}") % { type: type }
47
47
  end
48
48
  end
49
49
 
@@ -277,7 +277,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
277
277
 
278
278
  target_records = prefetch_hook(target_records) if respond_to?(:prefetch_hook)
279
279
 
280
- raise Puppet::DevError, "Prefetching #{target} for provider #{self.name} returned nil" unless target_records
280
+ raise Puppet::DevError, _("Prefetching %{target} for provider %{name} returned nil") % { target: target, name: self.name } unless target_records
281
281
 
282
282
  target_records
283
283
  end
@@ -350,7 +350,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
350
350
  def self.targets(resources = nil)
351
351
  targets = []
352
352
  # First get the default target
353
- raise Puppet::DevError, "Parsed Providers must define a default target" unless self.default_target
353
+ raise Puppet::DevError, _("Parsed Providers must define a default target") unless self.default_target
354
354
  targets << self.default_target
355
355
 
356
356
  # Then get each of the file objects
@@ -439,7 +439,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
439
439
 
440
440
  # Retrieve the current state from disk.
441
441
  def prefetch
442
- raise Puppet::DevError, "Somehow got told to prefetch with no resource set" unless @resource
442
+ raise Puppet::DevError, _("Somehow got told to prefetch with no resource set") unless @resource
443
443
  self.class.prefetch(@resource[:name] => @resource)
444
444
  end
445
445
 
@@ -115,7 +115,7 @@ Puppet::Type.type(:service).provide :base, :parent => :service do
115
115
  else
116
116
  pid = getpid
117
117
  unless pid
118
- self.info "#{self.name} is not running"
118
+ self.info _("%{name} is not running") % { name: self.name }
119
119
  return false
120
120
  end
121
121
  begin
@@ -140,8 +140,8 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
140
140
  if job.has_key?("Label")
141
141
  @label_to_path_map[job["Label"]] = filepath
142
142
  else
143
- Puppet.debug("The #{filepath} plist does not contain a 'label' key; " +
144
- "Puppet is skipping it")
143
+ #TRANSLATORS 'plist' and label' should not be translated
144
+ Puppet.debug(_("The %{file} plist does not contain a 'label' key; Puppet is skipping it") % { file: filepath })
145
145
  next
146
146
  end
147
147
  end
@@ -89,7 +89,8 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
89
89
  # Work around issue #4480
90
90
  # runsvdir takes up to 5 seconds to recognize
91
91
  # the symlink created by this call to enable
92
- Puppet.info "Waiting 5 seconds for runsvdir to discover service #{self.service}"
92
+ #TRANSLATORS 'runsvdir' is a linux service name and should not be translated
93
+ Puppet.info _("Waiting 5 seconds for runsvdir to discover service %{service}") % { service: self.service }
93
94
  sleep 5
94
95
  end
95
96
  sv "start", self.service
@@ -23,6 +23,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
23
23
  defaultfor :osfamily => :redhat, :operatingsystem => :fedora
24
24
  defaultfor :osfamily => :suse
25
25
  defaultfor :osfamily => :coreos
26
+ defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"]
26
27
  defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["8", "stretch/sid", "9", "buster/sid"]
27
28
  defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["15.04","15.10","16.04","16.10"]
28
29
  defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ["3"]
@@ -12,7 +12,7 @@ Puppet::Type.type(:service).provide :upstart, :parent => :debian do
12
12
  confine :any => [
13
13
  Facter.value(:operatingsystem) == 'Ubuntu',
14
14
  (Facter.value(:osfamily) == 'RedHat' and Facter.value(:operatingsystemrelease) =~ /^6\./),
15
- Facter.value(:operatingsystem) == 'Amazon',
15
+ (Facter.value(:operatingsystem) == 'Amazon' and Facter.value(:operatingsystemmajrelease) =~ /\d{4}/),
16
16
  Facter.value(:operatingsystem) == 'LinuxMint',
17
17
  ]
18
18
 
@@ -140,8 +140,10 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
140
140
  def get_arguments(key, value, mapping, objectinfo)
141
141
  # In the case of attributes, return a list of key=vlaue
142
142
  if key == :attributes
143
- raise Puppet::Error, "Attributes must be a list of pairs key=value on #{@resource.class.name}[#{@resource.name}]" \
144
- unless value and value.is_a? Hash
143
+ unless value and value.is_a? Hash
144
+ raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{class_name}[%{resource_name}]") %
145
+ { class_name: @resource.class.name, resource_name: @resource.name }
146
+ end
145
147
  return value.map { |k,v| k.to_s.strip + "=" + v.to_s.strip}
146
148
  end
147
149
 
@@ -170,9 +172,11 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
170
172
  def verify_group(value)
171
173
  if value.is_a? Integer
172
174
  groupname = groupname_by_id(value)
173
- raise ArgumentError, "AIX group must be a valid existing group" unless groupname
175
+ #TRANSLATORS 'AIX' is the name of the operating system and should not be translated
176
+ raise ArgumentError, _("AIX group must be a valid existing group") unless groupname
174
177
  else
175
- raise ArgumentError, "AIX group must be a valid existing group" unless groupid_by_name(value)
178
+ #TRANSLATORS 'AIX' is the name of the operating system and should not be translated
179
+ raise ArgumentError, _("AIX group must be a valid existing group") unless groupid_by_name(value)
176
180
  groupname = value
177
181
  end
178
182
  groupname
@@ -208,8 +212,11 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
208
212
  #expiry_date = d.strftime("%Y-%m-%d")
209
213
  expiry_date = "20#{$5}-#{$1}-#{$2}"
210
214
  else
211
- Puppet.warn("Could not convert AIX expires date '#{value}' on #{@resource.class.name}[#{@resource.name}]") \
212
- unless value == '0'
215
+ unless value == '0'
216
+ #TRANSLATORS 'AIX' is the name of an operating system and should not be translated
217
+ Puppet.warn(_("Could not convert AIX expires date '%{value}' on %{class_name}[%{resource_name}]") %
218
+ { value: value, class_name: @resource.class.name, resource_name: @resource.name })
219
+ end
213
220
  expiry_date = :absent
214
221
  end
215
222
  expiry_date
@@ -46,7 +46,8 @@ Puppet::Type.type(:user).provide :openbsd, :parent => :useradd do
46
46
  begin
47
47
  return unmunge(shadow_property, ent.send(method))
48
48
  rescue
49
- Puppet.warning "ruby-shadow doesn't support #{method}"
49
+ #TRANSLATORS 'ruby-shadow' is a Ruby gem library
50
+ Puppet.warning _("ruby-shadow doesn't support %{method}") % { method: method }
50
51
  end
51
52
  end
52
53
  end