bolt 0.11.0 → 0.12.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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bolt/cli.rb +127 -31
  3. data/lib/bolt/config.rb +39 -6
  4. data/lib/bolt/execution_result.rb +109 -0
  5. data/lib/bolt/executor.rb +4 -1
  6. data/lib/bolt/node.rb +6 -1
  7. data/lib/bolt/node/orch.rb +20 -2
  8. data/lib/bolt/node/winrm.rb +22 -10
  9. data/lib/bolt/node_uri.rb +5 -7
  10. data/lib/bolt/outputter/human.rb +60 -1
  11. data/lib/bolt/outputter/json.rb +11 -0
  12. data/lib/bolt/target.rb +32 -0
  13. data/lib/bolt/version.rb +1 -1
  14. data/modules/boltlib/lib/puppet/datatypes/executionresult.rb +30 -0
  15. data/modules/boltlib/lib/puppet/datatypes/target.rb +12 -0
  16. data/modules/boltlib/lib/puppet/functions/file_upload.rb +3 -3
  17. data/modules/boltlib/lib/puppet/functions/run_command.rb +3 -3
  18. data/modules/boltlib/lib/puppet/functions/run_script.rb +3 -3
  19. data/modules/boltlib/lib/puppet/functions/run_task.rb +10 -2
  20. data/vendored/puppet/lib/puppet/application/describe.rb +0 -1
  21. data/vendored/puppet/lib/puppet/configurer.rb +1 -1
  22. data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +15 -9
  23. data/vendored/puppet/lib/puppet/datatypes.rb +213 -0
  24. data/vendored/puppet/lib/puppet/datatypes/error.rb +19 -0
  25. data/vendored/puppet/lib/puppet/datatypes/impl/error.rb +42 -0
  26. data/vendored/puppet/lib/puppet/error.rb +1 -1
  27. data/vendored/puppet/lib/puppet/face/catalog.rb +1 -1
  28. data/vendored/puppet/lib/puppet/face/epp.rb +3 -3
  29. data/vendored/puppet/lib/puppet/face/help.rb +12 -14
  30. data/vendored/puppet/lib/puppet/face/man.rb +1 -0
  31. data/vendored/puppet/lib/puppet/face/module/search.rb +1 -1
  32. data/vendored/puppet/lib/puppet/face/node.rb +1 -0
  33. data/vendored/puppet/lib/puppet/face/parser.rb +0 -1
  34. data/vendored/puppet/lib/puppet/face/status.rb +1 -0
  35. data/vendored/puppet/lib/puppet/feature/base.rb +1 -1
  36. data/vendored/puppet/lib/puppet/file_bucket/dipper.rb +0 -1
  37. data/vendored/puppet/lib/puppet/file_system/uniquefile.rb +2 -2
  38. data/vendored/puppet/lib/puppet/forge/errors.rb +21 -29
  39. data/vendored/puppet/lib/puppet/functions.rb +64 -84
  40. data/vendored/puppet/lib/puppet/functions/defined.rb +0 -3
  41. data/vendored/puppet/lib/puppet/functions/find_file.rb +0 -1
  42. data/vendored/puppet/lib/puppet/functions/map.rb +0 -1
  43. data/vendored/puppet/lib/puppet/functions/regsubst.rb +1 -1
  44. data/vendored/puppet/lib/puppet/graph/simple_graph.rb +6 -10
  45. data/vendored/puppet/lib/puppet/indirector/catalog/compiler.rb +37 -25
  46. data/vendored/puppet/lib/puppet/indirector/file_server.rb +1 -1
  47. data/vendored/puppet/lib/puppet/indirector/indirection.rb +0 -2
  48. data/vendored/puppet/lib/puppet/indirector/rest.rb +9 -8
  49. data/vendored/puppet/lib/puppet/info_service/class_information_service.rb +1 -1
  50. data/vendored/puppet/lib/puppet/interface/option_manager.rb +1 -1
  51. data/vendored/puppet/lib/puppet/loaders.rb +1 -0
  52. data/vendored/puppet/lib/puppet/module.rb +6 -2
  53. data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  54. data/vendored/puppet/lib/puppet/module_tool/errors/installer.rb +29 -41
  55. data/vendored/puppet/lib/puppet/module_tool/errors/shared.rb +63 -138
  56. data/vendored/puppet/lib/puppet/module_tool/errors/uninstaller.rb +15 -37
  57. data/vendored/puppet/lib/puppet/module_tool/errors/upgrader.rb +18 -30
  58. data/vendored/puppet/lib/puppet/module_tool/installed_modules.rb +1 -1
  59. data/vendored/puppet/lib/puppet/module_tool/metadata.rb +0 -1
  60. data/vendored/puppet/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  61. data/vendored/puppet/lib/puppet/network/rights.rb +1 -1
  62. data/vendored/puppet/lib/puppet/node.rb +1 -1
  63. data/vendored/puppet/lib/puppet/node/environment.rb +1 -1
  64. data/vendored/puppet/lib/puppet/parameter/value_collection.rb +4 -17
  65. data/vendored/puppet/lib/puppet/parser/compiler.rb +1 -0
  66. data/vendored/puppet/lib/puppet/parser/functions.rb +0 -1
  67. data/vendored/puppet/lib/puppet/parser/functions/scanf.rb +1 -1
  68. data/vendored/puppet/lib/puppet/parser/scope.rb +4 -3
  69. data/vendored/puppet/lib/puppet/parser/script_compiler.rb +1 -0
  70. data/vendored/puppet/lib/puppet/parser/templatewrapper.rb +3 -2
  71. data/vendored/puppet/lib/puppet/parser/type_loader.rb +1 -1
  72. data/vendored/puppet/lib/puppet/pops.rb +1 -0
  73. data/vendored/puppet/lib/puppet/pops/evaluator/access_operator.rb +3 -2
  74. data/vendored/puppet/lib/puppet/pops/evaluator/closure.rb +1 -1
  75. data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -2
  76. data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +6 -5
  77. data/vendored/puppet/lib/puppet/pops/functions/function.rb +2 -2
  78. data/vendored/puppet/lib/puppet/pops/loader/loader.rb +1 -1
  79. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +40 -4
  80. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +6 -2
  81. data/vendored/puppet/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +8 -8
  82. data/vendored/puppet/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +40 -0
  83. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +6 -26
  84. data/vendored/puppet/lib/puppet/pops/loaders.rb +11 -2
  85. data/vendored/puppet/lib/puppet/pops/lookup/data_dig_function_provider.rb +1 -1
  86. data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +4 -14
  87. data/vendored/puppet/lib/puppet/pops/model/model_tree_dumper.rb +1 -1
  88. data/vendored/puppet/lib/puppet/pops/parser/code_merger.rb +2 -2
  89. data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +1471 -1501
  90. data/vendored/puppet/lib/puppet/pops/parser/epp_support.rb +0 -2
  91. data/vendored/puppet/lib/puppet/pops/parser/evaluating_parser.rb +1 -1
  92. data/vendored/puppet/lib/puppet/pops/parser/interpolation_support.rb +1 -1
  93. data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +2 -26
  94. data/vendored/puppet/lib/puppet/pops/parser/locator.rb +5 -7
  95. data/vendored/puppet/lib/puppet/pops/parser/parser_support.rb +2 -2
  96. data/vendored/puppet/lib/puppet/pops/parser/slurp_support.rb +0 -3
  97. data/vendored/puppet/lib/puppet/pops/pcore.rb +0 -11
  98. data/vendored/puppet/lib/puppet/pops/serialization/object.rb +3 -4
  99. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +1 -1
  100. data/vendored/puppet/lib/puppet/pops/time/timespan.rb +1 -1
  101. data/vendored/puppet/lib/puppet/pops/types/iterable.rb +14 -7
  102. data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +38 -7
  103. data/vendored/puppet/lib/puppet/pops/types/p_object_type_extension.rb +21 -22
  104. data/vendored/puppet/lib/puppet/pops/types/p_sem_ver_range_type.rb +0 -1
  105. data/vendored/puppet/lib/puppet/pops/types/p_type_set_type.rb +0 -1
  106. data/vendored/puppet/lib/puppet/pops/types/p_uri_type.rb +0 -1
  107. data/vendored/puppet/lib/puppet/pops/types/puppet_object.rb +1 -1
  108. data/vendored/puppet/lib/puppet/pops/types/string_converter.rb +5 -1
  109. data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +5 -1
  110. data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +1 -5
  111. data/vendored/puppet/lib/puppet/pops/types/type_formatter.rb +21 -0
  112. data/vendored/puppet/lib/puppet/pops/types/types.rb +2 -7
  113. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +1 -3
  114. data/vendored/puppet/lib/puppet/property.rb +1 -1
  115. data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +3 -4
  116. data/vendored/puppet/lib/puppet/provider/exec.rb +0 -2
  117. data/vendored/puppet/lib/puppet/provider/nameservice.rb +6 -1
  118. data/vendored/puppet/lib/puppet/provider/nameservice/directoryservice.rb +3 -3
  119. data/vendored/puppet/lib/puppet/provider/package/appdmg.rb +0 -1
  120. data/vendored/puppet/lib/puppet/provider/package/apple.rb +0 -1
  121. data/vendored/puppet/lib/puppet/provider/package/macports.rb +2 -2
  122. data/vendored/puppet/lib/puppet/provider/package/pkgdmg.rb +0 -1
  123. data/vendored/puppet/lib/puppet/provider/package/portage.rb +0 -1
  124. data/vendored/puppet/lib/puppet/provider/package/zypper.rb +2 -2
  125. data/vendored/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  126. data/vendored/puppet/lib/puppet/provider/service/init.rb +1 -0
  127. data/vendored/puppet/lib/puppet/provider/service/launchd.rb +3 -3
  128. data/vendored/puppet/lib/puppet/provider/user/aix.rb +1 -1
  129. data/vendored/puppet/lib/puppet/provider/user/openbsd.rb +1 -1
  130. data/vendored/puppet/lib/puppet/provider/user/pw.rb +1 -1
  131. data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +2 -4
  132. data/vendored/puppet/lib/puppet/provider/zfs/zfs.rb +1 -1
  133. data/vendored/puppet/lib/puppet/provider/zpool/zpool.rb +1 -1
  134. data/vendored/puppet/lib/puppet/reference/type.rb +0 -1
  135. data/vendored/puppet/lib/puppet/resource.rb +1 -2
  136. data/vendored/puppet/lib/puppet/resource/status.rb +0 -1
  137. data/vendored/puppet/lib/puppet/resource/type.rb +3 -3
  138. data/vendored/puppet/lib/puppet/resource/type_collection.rb +1 -1
  139. data/vendored/puppet/lib/puppet/settings/environment_conf.rb +0 -1
  140. data/vendored/puppet/lib/puppet/ssl/host.rb +1 -1
  141. data/vendored/puppet/lib/puppet/syntax_checkers/base64.rb +1 -1
  142. data/vendored/puppet/lib/puppet/transaction/persistence.rb +1 -1
  143. data/vendored/puppet/lib/puppet/type.rb +17 -4
  144. data/vendored/puppet/lib/puppet/type/file.rb +3 -3
  145. data/vendored/puppet/lib/puppet/type/mount.rb +9 -0
  146. data/vendored/puppet/lib/puppet/type/schedule.rb +25 -13
  147. data/vendored/puppet/lib/puppet/type/tidy.rb +2 -2
  148. data/vendored/puppet/lib/puppet/type/user.rb +1 -1
  149. data/vendored/puppet/lib/puppet/util.rb +19 -14
  150. data/vendored/puppet/lib/puppet/util/filetype.rb +2 -2
  151. data/vendored/puppet/lib/puppet/util/json_lockfile.rb +1 -1
  152. data/vendored/puppet/lib/puppet/util/log.rb +5 -3
  153. data/vendored/puppet/lib/puppet/util/log/destinations.rb +0 -1
  154. data/vendored/puppet/lib/puppet/util/monkey_patches.rb +1 -1
  155. data/vendored/puppet/lib/puppet/util/network_device/config.rb +2 -2
  156. data/vendored/puppet/lib/puppet/util/plist.rb +6 -4
  157. data/vendored/puppet/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
  158. data/vendored/puppet/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +1 -1
  159. data/vendored/puppet/lib/puppet/util/storage.rb +2 -2
  160. data/vendored/puppet/lib/puppet/util/windows/registry.rb +2 -2
  161. data/vendored/puppet/lib/puppet/util/windows/sid.rb +0 -2
  162. data/vendored/puppet/lib/puppet/version.rb +1 -1
  163. data/vendored/puppet/lib/puppet_pal.rb +30 -17
  164. metadata +28 -7
  165. data/vendored/puppet/lib/puppet/pops/types/execution_result.rb +0 -137
@@ -11,7 +11,7 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
11
11
  def authorized?(request)
12
12
  return false unless [:find, :search].include?(request.method)
13
13
 
14
- mount, file_path = configuration.split_path(request)
14
+ mount, _ = configuration.split_path(request)
15
15
 
16
16
  # If we're not serving this mount, then access is denied.
17
17
  return false unless mount
@@ -160,8 +160,6 @@ class Puppet::Indirector::Indirection
160
160
  # remove it, we expire it and write it back out to disk. This way people
161
161
  # can still use the expired object if they want.
162
162
  def expire(key, options={})
163
- request = request(:expire, key, nil, options)
164
-
165
163
  return nil unless cache?
166
164
 
167
165
  return nil unless instance = cache.find(request(:find, key, nil, options))
@@ -183,7 +183,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
183
183
  # While this way of handling the issue is not perfect, there is at least an error
184
184
  # that makes a user aware of the reason for the failure.
185
185
  #
186
- content_type, body = parse_response(response)
186
+ _, body = parse_response(response)
187
187
  msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(uri_with_query_string, 100), body: body }
188
188
  raise Puppet::Error, msg
189
189
  else
@@ -262,11 +262,13 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
262
262
 
263
263
  def handle_response(request, response)
264
264
  server_version = response[Puppet::Network::HTTP::HEADER_PUPPET_VERSION]
265
- if server_version &&
266
- SemanticPuppet::Version.parse(server_version).major < MAJOR_VERSION_JSON_DEFAULT &&
267
- Puppet[:preferred_serialization_format] != 'pson'
268
- Puppet.warning("Downgrading to PSON for future requests")
269
- Puppet[:preferred_serialization_format] = 'pson'
265
+ if server_version
266
+ Puppet.push_context({:server_agent_version => server_version})
267
+ if SemanticPuppet::Version.parse(server_version).major < MAJOR_VERSION_JSON_DEFAULT &&
268
+ Puppet[:preferred_serialization_format] != 'pson'
269
+ Puppet.warning("Downgrading to PSON for future requests")
270
+ Puppet[:preferred_serialization_format] = 'pson'
271
+ end
270
272
  end
271
273
  end
272
274
 
@@ -315,8 +317,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
315
317
  # uncompress_body)
316
318
  def parse_response(response)
317
319
  if response['content-type']
318
- [ response['content-type'].gsub(/\s*;.*$/,''),
319
- body = uncompress_body(response) ]
320
+ [ response['content-type'].gsub(/\s*;.*$/,''), uncompress_body(response) ]
320
321
  else
321
322
  raise _("No content type in http response; cannot parse")
322
323
  end
@@ -59,7 +59,7 @@ class Puppet::InfoService::ClassInformationService
59
59
  {:classes =>
60
60
  parse_result.definitions.select {|d| d.is_a?(Puppet::Pops::Model::HostClassDefinition)}.map do |d|
61
61
  {:name => d.name,
62
- :params => params = d.parameters.map {|p| extract_param(p) }
62
+ :params => d.parameters.map {|p| extract_param(p) }
63
63
  }
64
64
  end
65
65
  }
@@ -23,7 +23,7 @@ module Puppet::Interface::OptionManager
23
23
 
24
24
  # @api private
25
25
  def walk_inheritance_tree(start, sym)
26
- result = (start ||= [])
26
+ result = (start || [])
27
27
  if self.is_a?(Class) and superclass.respond_to?(sym)
28
28
  result = superclass.send(sym) + result
29
29
  elsif self.class.respond_to?(sym)
@@ -13,6 +13,7 @@ module Puppet
13
13
  require 'puppet/pops/loader/static_loader'
14
14
  require 'puppet/pops/loader/runtime3_type_loader'
15
15
  require 'puppet/pops/loader/ruby_function_instantiator'
16
+ require 'puppet/pops/loader/ruby_data_type_instantiator'
16
17
  require 'puppet/pops/loader/puppet_function_instantiator'
17
18
  require 'puppet/pops/loader/type_definition_instantiator'
18
19
  require 'puppet/pops/loader/puppet_resource_type_impl_instantiator'
@@ -333,7 +333,7 @@ class Puppet::Module
333
333
  def dependencies_as_modules
334
334
  dependent_modules = []
335
335
  dependencies and dependencies.each do |dep|
336
- author, dep_name = dep["name"].split('/')
336
+ _, dep_name = dep["name"].split('/')
337
337
  found_module = environment.module(dep_name)
338
338
  dependent_modules << found_module if found_module
339
339
  end
@@ -456,7 +456,11 @@ class Puppet::Module
456
456
 
457
457
  def assert_validity
458
458
  if !Puppet::Module.is_module_directory_name?(@name) && !Puppet::Module.is_module_namespaced_name?(@name)
459
- raise InvalidName, "Invalid module name #{@name}; module names must be alphanumeric (plus '-'), not '#{@name}'"
459
+ raise InvalidName, _(<<-ERROR_STRING).chomp % { name: @name }
460
+ Invalid module name '%{name}'; module names must match either:
461
+ An installed module name (ex. modulename) matching the expression /^[a-z][a-z0-9_]*$/ -or-
462
+ A namespaced module name (ex. author-modulename) matching the expression /^[a-zA-Z0-9]+[-][a-z][a-z0-9_]*$/
463
+ ERROR_STRING
460
464
  end
461
465
  end
462
466
  end
@@ -76,7 +76,7 @@ module Puppet::ModuleTool
76
76
  # @api private
77
77
  def module_name
78
78
  metadata = JSON.parse((root_dir + 'metadata.json').read)
79
- name = metadata['name'][/-(.*)/, 1]
79
+ metadata['name'][/-(.*)/, 1]
80
80
  end
81
81
 
82
82
  # @api private
@@ -12,24 +12,15 @@ module Puppet::ModuleTool::Errors
12
12
  end
13
13
 
14
14
  def multiline
15
- if @local_changes.empty?
16
- #TRANSLATORS `puppet module upgrade` and `puppet module upgrade` are a command line and should not be translated
17
- _(<<-MSG).chomp % { module_name: @module_name, requested_version: @requested_version, installed_version: @installed_version }
18
- Could not install module '%{module_name}' (%{requested_version})
19
- Module '%{module_name}' (%{installed_version}) is already installed
20
- Use `puppet module upgrade` to install a different version
21
- Use `puppet module install --force` to re-install only this module
22
- MSG
23
- else
24
- #TRANSLATORS `puppet module upgrade` and `puppet module upgrade` are a command line and should not be translated
25
- _(<<-MSG).chomp % { module_name: @module_name, requested_version: @requested_version, installed_version: @installed_version }
26
- Could not install module '%{module_name}' (%{requested_version})
27
- Module '%{module_name}' (%{installed_version}) is already installed
28
- Installed module has had changes made locally
29
- Use `puppet module upgrade` to install a different version
30
- Use `puppet module install --force` to re-install only this module
31
- MSG
32
- end
15
+ message = []
16
+ message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @module_name, version: @requested_version }
17
+ message << _(" Module '%{module_name}' (%{installed_version}) is already installed") % { module_name: @module_name, installed_version: @installed_version }
18
+ message << _(" Installed module has had changes made locally") unless @local_changes.empty?
19
+ #TRANSLATORS `puppet module upgrade` is a command line and should not be translated
20
+ message << _(" Use `puppet module upgrade` to install a different version")
21
+ #TRANSLATORS `puppet module install --force` is a command line and should not be translated
22
+ message << _(" Use `puppet module install --force` to re-install only this module")
23
+ message.join("\n")
33
24
  end
34
25
  end
35
26
 
@@ -42,11 +33,11 @@ Could not install module '%{module_name}' (%{requested_version})
42
33
  end
43
34
 
44
35
  def multiline
45
- _(<<-MSG).chomp % { requested_package: @requested_package, source: @source }
46
- Could not install '%{requested_package}'
47
- No releases are available from %{source}
48
- Does '%{requested_package}' have at least one published release?
49
- MSG
36
+ message = []
37
+ message << _("Could not install '%{requested_package}'") % { requested_package: @requested_package }
38
+ message << _(" No releases are available from %{source}") % { source: @source }
39
+ message << _(" Does '%{requested_package}' have at least one published release?") % { requested_package: @requested_package }
40
+ message.join("\n")
50
41
  end
51
42
  end
52
43
 
@@ -59,13 +50,12 @@ MSG
59
50
  end
60
51
 
61
52
  def multiline
62
- # TRANSLATORS "mkdir -p'%{dir}'" is a command line example and should not be translated
63
- _(<<-MSG).chomp % { module_name: @requested_module, version: @requested_version, dir: @directory }
64
- Could not install module '%{module_name}' (%{version})
65
- Path '%{dir}' exists but is not a directory.
66
- A potential solution is to rename the path and then
67
- mkdir -p '%{dir}'
68
- MSG
53
+ message = []
54
+ message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: @requested_version }
55
+ message << _(" Path '%{directory}' exists but is not a directory.") % { directory: @directory }
56
+ #TRANSLATORS "mkdir -p '%{directory}'" is a command line example and should not be translated
57
+ message << _(" A potential solution is to rename the path and then \"mkdir -p '%{directory}'\"") % { directory: @directory }
58
+ message.join("\n")
69
59
  end
70
60
  end
71
61
 
@@ -78,12 +68,11 @@ Could not install module '%{module_name}' (%{version})
78
68
  end
79
69
 
80
70
  def multiline
81
- _(<<-MSG).chomp % { module_name: @requested_module, version: @requested_version, dir: @directory }
82
- Could not install module '%{module_name}' (%{version})
83
- Permission is denied when trying to create directory '%{dir}'.
84
- A potential solution is to check the ownership and permissions of
85
- parent directories.
86
- MSG
71
+ message = []
72
+ message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: @requested_version }
73
+ message << _(" Permission is denied when trying to create directory '%{directory}'.") % { directory: @directory }
74
+ message << _(' A potential solution is to check the ownership and permissions of parent directories.')
75
+ message.join("\n")
87
76
  end
88
77
  end
89
78
 
@@ -95,11 +84,10 @@ Could not install module '%{module_name}' (%{version})
95
84
  end
96
85
 
97
86
  def multiline
98
- _(<<-MSG).chomp % { path: @entry_path.inspect, dir: @directory.inspect }
99
- Could not install package with an invalid path.
100
- Package attempted to install file into
101
- %{path} under %{dir}.
102
- MSG
87
+ message = []
88
+ message << _('Could not install package with an invalid path.')
89
+ message << _(' Package attempted to install file into %{path} under %{directory}.') % { path: @entry_path.inspect, directory: @directory.inspect }
90
+ message.join("\n")
103
91
  end
104
92
  end
105
93
  end
@@ -12,12 +12,12 @@ module Puppet::ModuleTool::Errors
12
12
  end
13
13
 
14
14
  def multiline
15
+ message = []
16
+ message << _("Could not %{action} module '%{module_name}' (%{version})") % { action: @action, module_name: @requested_name, version: vstring }
17
+ message << _(" No version of '%{module_name}' can satisfy all dependencies") % { module_name: @requested_name }
15
18
  #TRANSLATORS `puppet module %{action} --ignore-dependencies` is a command line and should not be translated
16
- _(<<-EOM).chomp % { action: @action, module_name: @requested_name, version: vstring }
17
- Could not %{action} module '%{module_name}' (%{version})
18
- No version of '%{module_name}' can satisfy all dependencies
19
- Use `puppet module %{action} --ignore-dependencies` to %{action} only this module
20
- EOM
19
+ message << _(" Use `puppet module %{action} --ignore-dependencies` to %{action} only this module") % { action: @action }
20
+ message.join("\n")
21
21
  end
22
22
  end
23
23
 
@@ -37,18 +37,15 @@ Could not %{action} module '%{module_name}' (%{version})
37
37
  end
38
38
 
39
39
  def multiline
40
+ message = []
41
+ message << _("Could not %{action} '%{module_name}' (%{version})") % { action: @action, module_name: @module_name, version: vstring }
40
42
  if @requested_version == :latest
41
- _(<<-EOM).chomp % { action: @action, module_name: @module_name, version: vstring, source: @source }
42
- Could not %{action} '%{module_name}' (%{version})
43
- No releases are available from %{source}
44
- Does '%{module_name}' have at least one published release?
45
- EOM
43
+ message << _(" No releases are available from %{source}") % { source: @source }
44
+ message << _(" Does '%{module_name}' have at least one published release?") % { module_name: @module_name }
46
45
  else
47
- _(<<-EOM).chomp % { action: @action, module_name: @module_name, version: vstring, requested_version: @requested_version, source: @source }
48
- Could not %{action} '%{module_name}' (%{version})
49
- No releases matching '%{requested_version}' are available from %{source}
50
- EOM
46
+ message << _(" No releases matching '%{requested_version}' are available from %{source}") % { requested_version: @requested_version, source: @source }
51
47
  end
48
+ message.join("\n")
52
49
  end
53
50
  end
54
51
 
@@ -63,49 +60,27 @@ Could not %{action} '%{module_name}' (%{version})
63
60
  end
64
61
 
65
62
  def multiline
63
+ message = []
64
+ message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: @requested_version }
65
+
66
66
  if @dependency
67
- if @metadata
68
- msg_variables = { module_name: @requested_module, requested_version: @requested_version,
69
- name: @dependency[:name], version: v(@dependency[:version]),
70
- directory: @directory, current_name: @metadata["name"], current_version: v(@metadata["version"]) }
71
- #TRANSLATORS `puppet module install --ignore-dependencies` is a command line and should not be translated
72
- _(<<-EOM).chomp % msg_variables
73
- Could not install module '%{module_name}' (%{requested_version})
74
- Dependency '%{name}' (%{version}) would overwrite %{directory}
75
- Currently, '%{current_name}' (%{current_version}) is installed to that directory
76
- Use `puppet module install --ignore-dependencies` to install only this module
77
- EOM
78
- else
79
- msg_variables = { module_name: @requested_module, requested_version: @requested_version,
80
- name: @dependency[:name], version: v(@dependency[:version]), directory: @directory }
81
- #TRANSLATORS `puppet module install --ignore-dependencies` is a command line and should not be translated
82
- _(<<-EOM).chomp % msg_variables
83
- Could not install module '%{module_name}' (%{requested_version})
84
- Dependency '%{name}' (%{version}) would overwrite %{directory}
85
- Use `puppet module install --ignore-dependencies` to install only this module
86
- EOM
87
- end
67
+ message << _(" Dependency '%{name}' (%{version}) would overwrite %{directory}") % { name: @dependency[:name], version: v(@dependency[:version]), directory: @directory }
68
+ else
69
+ message << _(" Installation would overwrite %{directory}") % { directory: @directory }
70
+ end
71
+
72
+ if @metadata
73
+ message << _(" Currently, '%{current_name}' (%{current_version}) is installed to that directory") % { current_name: @metadata["name"], current_version: v(@metadata["version"]) }
74
+ end
88
75
 
76
+ if @dependency
77
+ #TRANSLATORS `puppet module install --ignore-dependencies` is a command line and should not be translated
78
+ message << _(" Use `puppet module install --ignore-dependencies` to install only this module")
89
79
  else
90
- if @metadata
91
- msg_variables = { module_name: @requested_module, requested_version: @requested_version,
92
- directory: @directory, current_name: @metadata["name"], current_version: v(@metadata["version"]) }
93
- #TRANSLATORS `puppet module install --force` is a command line and should not be translated
94
- _(<<-EOM).chomp % msg_variables
95
- Could not install module '%{module_name}' (%{requested_version})
96
- Installation would overwrite %{directory}
97
- Currently, '%{current_name}' (%{current_version}) is installed to that directory
98
- Use `puppet module install --force` to install this module anyway
99
- EOM
100
- else
101
- #TRANSLATORS `puppet module install --force` is a command line and should not be translated
102
- _(<<-EOM).chomp % { module_name: @requested_module, requested_version: @requested_version, directory: @directory }
103
- Could not install module '%{module_name}' (%{requested_version})
104
- Installation would overwrite %{directory}
105
- Use `puppet module install --force` to install this module anyway
106
- EOM
107
- end
80
+ #TRANSLATORS `puppet module install --force` is a command line and should not be translated
81
+ message << _(" Use `puppet module install --force` to install this module anyway")
108
82
  end
83
+ message.join("\n")
109
84
  end
110
85
  end
111
86
 
@@ -121,33 +96,19 @@ Could not install module '%{module_name}' (%{requested_version})
121
96
  end
122
97
 
123
98
  def multiline
99
+ dependency_list = []
100
+ dependency_list << _("You specified '%{name}' (%{version})") % { name: @source.first[:name], version: v(@requested_version) }
124
101
  dependency_list = @source[1..-1].map do |m|
125
102
  #TRANSLATORS This message repeats as separate lines as a list under the heading "You specified '%{name}' (%{version})\n"
126
- _(" which depends on '%{name}' (%{version})") % { name: m[:name], version: v(m[:version]) }
127
- end.join(",\n")
128
-
129
- if dependency_list.empty?
130
- msg_variables = { requested_module_name: @requested_module, version: v(@requested_version), module_name: @module_name,
131
- name: @source.first[:name] }
132
- #TRANSLATORS `puppet module install --force` is a command line and should not be translated
133
- _(<<-EOM).chomp % msg_variables
134
- Could not install module '%{requested_module_name}' (%{version})
135
- No version of '%{module_name}' will satisfy dependencies
136
- You specified '%{name}' (%{version})
137
- Use `puppet module install --force` to install this module anyway
138
- EOM
139
- else
140
- msg_variables = { requested_module_name: @requested_module, version: v(@requested_version), module_name: @module_name,
141
- name: @source.first[:name], dependency_list: dependency_list }
142
- #TRANSLATORS `puppet module install --force` is a command line and should not be translated
143
- _(<<-EOM).chomp % msg_variables
144
- Could not install module '%{requested_module_name}' (%{version})
145
- No version of '%{module_name}' will satisfy dependencies
146
- You specified '%{name}' (%{version})
147
- %{dependency_list}
148
- Use `puppet module install --force` to install this module anyway
149
- EOM
103
+ _("which depends on '%{name}' (%{version})") % { name: m[:name], version: v(m[:version]) }
150
104
  end
105
+ message = []
106
+ message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: v(@requested_version) }
107
+ message << _(" No version of '%{module_name}' will satisfy dependencies") % { module_name: @module_name }
108
+ message << dependency_list.map {|s| " #{s}".join(",\n")}
109
+ #TRANSLATORS `puppet module install --force` is a command line and should not be translated
110
+ message << _(" Use `puppet module install --force` to install this module anyway")
111
+ message.join("\n")
151
112
  end
152
113
  end
153
114
 
@@ -160,41 +121,16 @@ Could not install module '%{requested_module_name}' (%{version})
160
121
  end
161
122
 
162
123
  def multiline
163
- suggestion_list = @suggestions.map do |suggestion|
124
+ message = []
125
+ message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @module_name }
126
+ message << _(" Module '%{module_name}' is not installed") % { module_name: @module_name }
127
+ message += @suggestions.map do |suggestion|
128
+ #TRANSLATORS `puppet module %{action} %{suggestion}` is a command line and should not be translated
164
129
  _(" You may have meant `puppet module %{action} %{suggestion}`") % { action: @action, suggestion: suggestion }
165
- end.join("\n")
166
-
167
- if @action == :upgrade
168
- if suggestion_list.empty?
169
- # TRANSLATORS `puppet module install` is a command line and should not be translated
170
- _(<<-EOM).chomp % { action: @action, module_name: @module_name }
171
- Could not %{action} module '%{module_name}'
172
- Module '%{module_name}' is not installed
173
- Use `puppet module install` to install this module
174
- EOM
175
- else
176
- # TRANSLATORS `puppet module install` is a command line and should not be translated
177
- _(<<-EOM).chomp % { action: @action, module_name: @module_name, suggestion_list: suggestion_list }
178
- Could not %{action} module '%{module_name}'
179
- Module '%{module_name}' is not installed
180
- %{suggestion_list}
181
- Use `puppet module install` to install this module
182
- EOM
183
- end
184
- else
185
- if suggestion_list.empty?
186
- _(<<-EOM).chomp % { action: @action, module_name: @module_name }
187
- Could not %{action} module '%{module_name}'
188
- Module '%{module_name}' is not installed
189
- EOM
190
- else
191
- _(<<-EOM).chomp % { action: @action, module_name: @module_name, suggestion_list: suggestion_list }
192
- Could not %{action} module '%{module_name}'
193
- Module '%{module_name}' is not installed
194
- %{suggestion_list}
195
- EOM
196
- end
197
130
  end
131
+ #TRANSLATORS `puppet module install` is a command line and should not be translated
132
+ message << _(" Use `puppet module install` to install this module") if @action == :upgrade
133
+ message.join("\n")
198
134
  end
199
135
  end
200
136
 
@@ -208,27 +144,16 @@ Could not %{action} module '%{module_name}'
208
144
  end
209
145
 
210
146
  def multiline
211
- module_path_list = @modules.map do |mod|
147
+ message = []
148
+ message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @module_name }
149
+ message << _(" Module '%{module_name}' appears multiple places in the module path") % { module_name: @module_name }
150
+ message += @modules.map do |mod|
212
151
  #TRANSLATORS This is repeats as separate lines as a list under "Module '%{module_name}' appears multiple places in the module path"
213
152
  _(" '%{module_name}' (%{version}) was found in %{path}") % { module_name: @module_name, version: v(mod.version), path: mod.modulepath }
214
- end.join("\n")
215
-
216
- if module_path_list.empty?
217
- # TRANSLATORS `--modulepath` is command line option and should not be translated
218
- _(<<-EOM).chomp % { action: @action, module_name: @module_name }
219
- Could not %{action} module '%{module_name}'
220
- Module '%{module_name}' appears multiple places in the module path
221
- Use the `--modulepath` option to limit the search to specific directories
222
- EOM
223
- else
224
- # TRANSLATORS `--modulepath` is command line option and should not be translated
225
- _(<<-EOM).chomp % { action: @action, module_name: @module_name, module_path_list: module_path_list }
226
- Could not %{action} module '%{module_name}'
227
- Module '%{module_name}' appears multiple places in the module path
228
- %{module_path_list}
229
- Use the `--modulepath` option to limit the search to specific directories
230
- EOM
231
153
  end
154
+ #TRANSLATORS `--modulepath` is command line option and should not be translated
155
+ message << _(" Use the `--modulepath` option to limit the search to specific directories")
156
+ message.join("\n")
232
157
  end
233
158
  end
234
159
 
@@ -242,12 +167,12 @@ Could not %{action} module '%{module_name}'
242
167
  end
243
168
 
244
169
  def multiline
170
+ message = []
171
+ message << _("Could not %{action} module '%{module_name}' (%{version})") % { action: @action, module_name: @module_name, version: vstring }
172
+ message << _(" Installed module has had changes made locally")
245
173
  #TRANSLATORS `puppet module %{action} --ignore-changes` is a command line and should not be translated
246
- _(<<-EOM).chomp % { action: @action, module_name: @module_name, version: vstring }
247
- Could not %{action} module '%{module_name}' (%{version})
248
- Installed module has had changes made locally
249
- Use `puppet module %{action} --ignore-changes` to %{action} this module anyway
250
- EOM
174
+ message << _(" Use `puppet module %{action} --ignore-changes` to %{action} this module anyway") % { action: @action }
175
+ message.join("\n")
251
176
  end
252
177
  end
253
178
 
@@ -260,11 +185,11 @@ Could not %{action} module '%{module_name}' (%{version})
260
185
  end
261
186
 
262
187
  def multiline
263
- _(<<-EOM).chomp % { action: @action, module_name: @name, message: @error.message }
264
- Could not %{action} module '%{module_name}'
265
- Failure trying to parse metadata
266
- Original message was: %{message}
267
- EOM
188
+ message = []
189
+ message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @name }
190
+ message << _(" Failure trying to parse metadata")
191
+ message << _(" Original message was: %{message}") % { message: @error.message }
192
+ message.join("\n")
268
193
  end
269
194
  end
270
195
  end