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
@@ -569,6 +569,10 @@ class StringConverter
569
569
  end
570
570
  end
571
571
 
572
+ def string_PObjectTypeExtension(val_type, val, format_map, indentation)
573
+ string_PObjectType(val_type.base_type, val, format_map, indentation)
574
+ end
575
+
572
576
  def string_PRuntimeType(val_type, val, format_map, indent)
573
577
  # Before giving up on this, and use a string representation of the unknown
574
578
  # object, a check is made to see if the object can present itself as
@@ -715,7 +719,7 @@ class StringConverter
715
719
  when :c
716
720
  char = [val].pack("U")
717
721
  char = f.alt? ? "\"#{char}\"" : char
718
- char = Kernel.format(f.orig_fmt.gsub('c','s'), char)
722
+ Kernel.format(f.orig_fmt.gsub('c','s'), char)
719
723
 
720
724
  when :s
721
725
  fmt = f.alt? ? 'p' : 's'
@@ -515,7 +515,11 @@ class TypeCalculator
515
515
  return PRuntimeType.new(:ruby, nil) if name.nil? # anonymous class that doesn't implement PuppetObject is impossible to infer
516
516
  ir = Loaders.implementation_registry
517
517
  type = ir.nil? ? nil : ir.type_for_module(name)
518
- type.nil? ? PRuntimeType.new(:ruby, name) : type
518
+ return PRuntimeType.new(:ruby, name) if type.nil?
519
+ if type.is_a?(PObjectType) && type.parameterized?
520
+ type = PObjectTypeExtension.create_from_instance(type, o)
521
+ end
522
+ type
519
523
  end
520
524
  end
521
525
 
@@ -521,11 +521,7 @@ module TypeFactory
521
521
  # @api public
522
522
  #
523
523
  def self.error
524
- @error_t ||= TypeParser.singleton.parse('Error', Loaders.static_loader)
525
- end
526
-
527
- def self.target
528
- @target_t ||= TypeParser.singleton.parse('Target')
524
+ @error_t ||= TypeParser.singleton.parse('Error', Loaders.loaders.puppet_system_loader)
529
525
  end
530
526
 
531
527
  def self.task
@@ -337,6 +337,27 @@ class TypeFormatter
337
337
  append_array('Collection', range.empty? ) { append_elements(range) }
338
338
  end
339
339
 
340
+ def string_Object(t)
341
+ type = TypeCalculator.infer(t)
342
+ if type.is_a?(PObjectTypeExtension)
343
+ type = type.base_type
344
+ end
345
+ if type.is_a?(PObjectType)
346
+ init_hash = type.extract_init_hash(t)
347
+ @bld << type.name << '('
348
+ if @indent
349
+ append_indented_string(init_hash, @indent, @indent_width, true)
350
+ @bld.chomp!
351
+ else
352
+ append_string(init_hash)
353
+ end
354
+ @bld << ')'
355
+ else
356
+ @bld << 'Instance of '
357
+ append_string(type)
358
+ end
359
+ end
360
+
340
361
  def string_PuppetObject(t)
341
362
  @bld << t._pcore_type.name << '('
342
363
  if @indent
@@ -59,10 +59,6 @@ class TypedModelObject < Object
59
59
  Annotation.register_ptype(loader, ir),
60
60
  RubyMethod.register_ptype(loader, ir),
61
61
  ]
62
- if Puppet[:tasks]
63
- types << ExecutionResult.register_ptype(loader, ir)
64
- end
65
-
66
62
  Types.constants.each do |c|
67
63
  next if c == :PType || c == :PHostClassType
68
64
  cls = Types.const_get(c)
@@ -2059,7 +2055,6 @@ class PStructType < PAnyType
2059
2055
  if self == DEFAULT
2060
2056
  PIterableType.new(PHashType::DEFAULT_KEY_PAIR_TUPLE)
2061
2057
  else
2062
- tc = TypeCalculator.singleton
2063
2058
  PIterableType.new(
2064
2059
  PTupleType.new([
2065
2060
  PVariantType.maybe_create(@elements.map {|se| se.key_type }),
@@ -2363,11 +2358,11 @@ class PCallableType < PAnyType
2363
2358
  def self.register_ptype(loader, ir)
2364
2359
  create_ptype(loader, ir, 'AnyType',
2365
2360
  'param_types' => {
2366
- KEY_TYPE => POptionalType.new(PTupleType::DEFAULT),
2361
+ KEY_TYPE => POptionalType.new(PTypeType.new(PTupleType::DEFAULT)),
2367
2362
  KEY_VALUE => nil
2368
2363
  },
2369
2364
  'block_type' => {
2370
- KEY_TYPE => POptionalType.new(PCallableType::DEFAULT),
2365
+ KEY_TYPE => POptionalType.new(PTypeType.new(PCallableType::DEFAULT)),
2371
2366
  KEY_VALUE => nil
2372
2367
  },
2373
2368
  'return_type' => {
@@ -386,9 +386,7 @@ class Checker4_0 < Evaluator::LiteralEvaluator
386
386
  }
387
387
 
388
388
  FUTURE_RESERVED_WORDS = {
389
- 'application' => true,
390
- 'produces' => true,
391
- 'consumes' => true
389
+ 'plan' => true
392
390
  }
393
391
 
394
392
  # for 'class', 'define', and function
@@ -364,7 +364,7 @@ class Puppet::Property < Puppet::Parameter
364
364
  begin
365
365
  @should = should
366
366
  insync?(is)
367
- rescue => detail
367
+ rescue
368
368
  # Certain operations may fail, but we don't want to fail the transaction if we can
369
369
  # avoid it
370
370
  msg = "Unknown failure using insync_values? on type: #{self.resource.ref} / property: #{self.name} to compare values #{should} and #{is}"
@@ -168,7 +168,6 @@ Puppet::Type.type(:augeas).provide(:augeas) do
168
168
  glob_avail = !aug.match("/augeas/version/pathx/functions/glob").empty?
169
169
  opt_ctx = resource[:context].match("^/files/[^'\"\\[\\]]+$") if resource[:context]
170
170
 
171
- restricted = false
172
171
  if resource[:incl]
173
172
  aug.set("/augeas/load/Xfm/lens", resource[:lens])
174
173
  aug.set("/augeas/load/Xfm/incl", resource[:incl])
@@ -220,7 +219,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do
220
219
 
221
220
  #validate and tear apart the command
222
221
  fail (_("Invalid command: %{cmd}") % { cmd: cmd_array.join(" ") }) if cmd_array.length < 4
223
- cmd = cmd_array.shift
222
+ _ = cmd_array.shift
224
223
  path = cmd_array.shift
225
224
  comparator = cmd_array.shift
226
225
  arg = cmd_array.join(" ")
@@ -251,7 +250,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do
251
250
 
252
251
  #validate and tear apart the command
253
252
  fail(_("Invalid command: %{cmd}") % { cmd: cmd_array.join(" ") }) if cmd_array.length < 3
254
- cmd = cmd_array.shift
253
+ _ = cmd_array.shift
255
254
  path = cmd_array.shift
256
255
 
257
256
  # Need to break apart the clause
@@ -299,7 +298,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do
299
298
 
300
299
  #validate and tear apart the command
301
300
  fail(_("Invalid command: %{cmd}") % { cmd: cmd_array.join(" ") }) if cmd_array.length < 3
302
- cmd = cmd_array.shift
301
+ _ = cmd_array.shift
303
302
  path = cmd_array.shift
304
303
 
305
304
  # Need to break apart the clause
@@ -6,8 +6,6 @@ class Puppet::Provider::Exec < Puppet::Provider
6
6
 
7
7
  def run(command, check = false)
8
8
  output = nil
9
- status = nil
10
- dir = nil
11
9
  sensitive = resource.parameters[:command].sensitive
12
10
 
13
11
  checkexe(command)
@@ -263,7 +263,12 @@ class Puppet::Provider::NameService < Puppet::Provider
263
263
  # reading of the file.
264
264
  Puppet::Etc.endgrent
265
265
 
266
- groups.join(",")
266
+ uniq_groups = groups.uniq
267
+ if groups != uniq_groups
268
+ debug("Removing any duplicate group entries")
269
+ end
270
+ # remove any double listed groups
271
+ uniq_groups.join(",")
267
272
  end
268
273
 
269
274
  # Convert the Etc struct into a hash.
@@ -401,10 +401,10 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
401
401
  next if property == :ensure
402
402
  value = @resource.should(property)
403
403
  if property == :gid and value.nil?
404
- value = self.class.next_system_id(id_type='gid')
404
+ value = self.class.next_system_id('gid')
405
405
  end
406
406
  if property == :uid and value.nil?
407
- value = self.class.next_system_id(id_type='uid')
407
+ value = self.class.next_system_id('uid')
408
408
  end
409
409
  if value != "" and not value.nil?
410
410
  if property == :members
@@ -430,7 +430,7 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
430
430
  cmd = [:dseditgroup, "-o", "edit", "-n", ".", "-d", member, @resource[:name]]
431
431
  begin
432
432
  execute(cmd)
433
- rescue Puppet::ExecutionFailure => detail
433
+ rescue Puppet::ExecutionFailure
434
434
  # TODO: We're falling back to removing the member using dscl due to rdar://8481241
435
435
  # This bug causes dseditgroup to fail to remove a member if that member doesn't exist
436
436
  cmd = [:dscl, ".", "-delete", "/Groups/#{@resource.name}", "GroupMembership", member]
@@ -98,7 +98,6 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Packag
98
98
  end
99
99
 
100
100
  def install
101
- source = nil
102
101
  unless source = @resource[:source]
103
102
  self.fail _("Mac OS X PKG DMGs must specify a package source.")
104
103
  end
@@ -37,7 +37,6 @@ Puppet::Type.type(:package).provide :apple, :parent => Puppet::Provider::Package
37
37
  end
38
38
 
39
39
  def install
40
- source = nil
41
40
  unless source = @resource[:source]
42
41
  self.fail _("Mac OS X packages must specify a package source")
43
42
  end
@@ -61,9 +61,9 @@ Puppet::Type.type(:package).provide :macports, :parent => Puppet::Provider::Pack
61
61
  def install
62
62
  should = @resource.should(:ensure)
63
63
  if [:latest, :installed, :present].include?(should)
64
- output = port("-q", :install, @resource[:name])
64
+ port("-q", :install, @resource[:name])
65
65
  else
66
- output = port("-q", :install, @resource[:name], "@#{should}")
66
+ port("-q", :install, @resource[:name], "@#{should}")
67
67
  end
68
68
  # MacPorts now correctly exits non-zero with appropriate errors in
69
69
  # situations where a port cannot be found or installed.
@@ -140,7 +140,6 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
140
140
  end
141
141
 
142
142
  def install
143
- source = nil
144
143
  unless source = @resource[:source]
145
144
  raise Puppet::Error.new(_("Mac OS X PKG DMGs must specify a package source."))
146
145
  end
@@ -109,7 +109,6 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
109
109
  result_format = self.qatom_result_format
110
110
  result_fields = self.qatom_result_fields
111
111
  @atom ||= begin
112
- search_output = nil
113
112
  package_info = {}
114
113
  # do the search
115
114
  search_output = qatom_bin *([@resource[:name], '--format', output_format])
@@ -126,7 +126,7 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
126
126
 
127
127
  def uninstall
128
128
  #extract version numbers and convert to integers
129
- major, minor, patch = zypper_version.scan(/\d+/).map{ |x| x.to_i }
129
+ major, minor, _ = zypper_version.scan(/\d+/).map{ |x| x.to_i }
130
130
 
131
131
  if major < 1
132
132
  super
@@ -137,7 +137,7 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
137
137
  end
138
138
 
139
139
  options << @resource[:name]
140
-
140
+
141
141
  zypper *options
142
142
  end
143
143
 
@@ -308,7 +308,7 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
308
308
  trigger['type']['days_of_week'] = if puppet_trigger['day_of_week']
309
309
  bitfield_from_days_of_week(puppet_trigger['day_of_week'])
310
310
  else
311
- scheduler_days_of_week.inject(0) {|day_flags,day| day_flags |= day}
311
+ scheduler_days_of_week.inject(0) {|day_flags,day| day_flags | day}
312
312
  end
313
313
  when 'monthly'
314
314
  trigger['type'] = {
@@ -426,7 +426,7 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
426
426
  day = 32 if day == 'last'
427
427
 
428
428
  integer_day = Integer(day)
429
- self.fail "Day must be specified as an integer in the range 1-31, or as 'last'" unless integer_day = day.to_f and integer_day.between?(1,32)
429
+ self.fail "Day must be specified as an integer in the range 1-31, or as 'last'" unless integer_day.between?(1,32)
430
430
 
431
431
  bitfield |= 1 << integer_day - 1
432
432
  end
@@ -72,6 +72,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
72
72
  excludes += %w{cryptdisks-udev}
73
73
  excludes += %w{statd-mounting}
74
74
  excludes += %w{gssd-mounting}
75
+ excludes
75
76
  end
76
77
 
77
78
  # List all services of this type.
@@ -238,7 +238,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
238
238
  # directly.
239
239
  def start
240
240
  return ucommand(:start) if resource[:start]
241
- job_path, job_plist = plist_from_label(resource[:name])
241
+ job_path, _ = plist_from_label(resource[:name])
242
242
  did_enable_job = false
243
243
  cmds = []
244
244
  cmds << :launchctl << :load
@@ -261,7 +261,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
261
261
 
262
262
  def stop
263
263
  return ucommand(:stop) if resource[:stop]
264
- job_path, job_plist = plist_from_label(resource[:name])
264
+ job_path, _ = plist_from_label(resource[:name])
265
265
  did_disable_job = false
266
266
  cmds = []
267
267
  cmds << :launchctl << :unload
@@ -297,7 +297,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
297
297
  job_plist_disabled = nil
298
298
  overrides_disabled = nil
299
299
 
300
- job_path, job_plist = plist_from_label(resource[:name])
300
+ _, job_plist = plist_from_label(resource[:name])
301
301
  job_plist_disabled = job_plist["Disabled"] if job_plist.has_key?("Disabled")
302
302
 
303
303
  if FileTest.file?(self.class.launchd_overrides) and overrides = self.class.read_plist(self.class.launchd_overrides)
@@ -286,7 +286,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
286
286
  def managed_attribute_keys(hash)
287
287
  managed_attributes ||= @resource.original_parameters[:attributes] || hash.keys.map{|k| k.to_s}
288
288
  managed_attributes = [managed_attributes] unless managed_attributes.is_a?(Array)
289
- managed_attributes.map {|attr| key, value = attr.split("="); key.strip.to_sym}
289
+ managed_attributes.map {|attr| key, _ = attr.split("="); key.strip.to_sym}
290
290
  end
291
291
 
292
292
  def should_include?(key, managed_keys)
@@ -45,7 +45,7 @@ Puppet::Type.type(:user).provide :openbsd, :parent => :useradd do
45
45
  # sp_loginclass field.
46
46
  begin
47
47
  return unmunge(shadow_property, ent.send(method))
48
- rescue => detail
48
+ rescue
49
49
  Puppet.warning "ruby-shadow doesn't support #{method}"
50
50
  end
51
51
  end
@@ -67,7 +67,7 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
67
67
  # use pw to update password hash
68
68
  def password=(cryptopw)
69
69
  Puppet.debug "change password for user '#{@resource[:name]}' method called with hash '#{cryptopw}'"
70
- stdin, stdout, stderr = Open3.popen3("pw user mod #{@resource[:name]} -H 0")
70
+ stdin, _, _ = Open3.popen3("pw user mod #{@resource[:name]} -H 0")
71
71
  stdin.puts(cryptopw)
72
72
  stdin.close
73
73
  Puppet.debug "finished password for user '#{@resource[:name]}' method called with hash '#{cryptopw}'"
@@ -76,8 +76,8 @@ Puppet::Type.type(:yumrepo).provide(:inifile) do
76
76
  # Use directories in reposdir if they are set instead of default
77
77
  if reposdir
78
78
  # Follow the code from the yum/config.py
79
- dirs = reposdir.gsub!("\n", ' ')
80
- dirs = reposdir.gsub!(',', ' ')
79
+ reposdir.gsub!("\n", ' ')
80
+ reposdir.gsub!(',', ' ')
81
81
  dirs = reposdir.split
82
82
  end
83
83
  dirs.select! { |dir| Puppet::FileSystem.exist?(dir) }
@@ -203,8 +203,6 @@ Puppet::Type.type(:yumrepo).provide(:inifile) do
203
203
  def create
204
204
  @property_hash[:ensure] = :present
205
205
 
206
- new_section = current_section
207
-
208
206
  # We fetch a list of properties from the type, then iterate
209
207
  # over them, avoiding ensure. We're relying on .should to
210
208
  # check if the property has been set and should be modified,
@@ -5,7 +5,7 @@ Puppet::Type.type(:zfs).provide(:zfs) do
5
5
 
6
6
  def self.instances
7
7
  zfs(:list, '-H').split("\n").collect do |line|
8
- name,used,avail,refer,mountpoint = line.split(/\s+/)
8
+ name, _used, _avail, _refer, _mountpoint = line.split(/\s+/)
9
9
  new({:name => name, :ensure => :present})
10
10
  end
11
11
  end
@@ -6,7 +6,7 @@ Puppet::Type.type(:zpool).provide(:zpool) do
6
6
  #NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
7
7
  def self.instances
8
8
  zpool(:list, '-H').split("\n").collect do |line|
9
- name, size, alloc, free, cap, health, altroot = line.split(/\s+/)
9
+ name, _size, _alloc, _free, _cap, _health, _altroot = line.split(/\s+/)
10
10
  new({:name => name, :ensure => :present})
11
11
  end
12
12
  end
@@ -79,7 +79,6 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
79
79
 
80
80
  raise _("Could not retrieve property %{sname} on type %{type_name}") % { sname: sname, type_name: type.name } unless property
81
81
 
82
- doc = nil
83
82
  unless doc = property.doc
84
83
  $stderr.puts _("No docs for %{type}[%{sname}]") % { type: type, sname: sname }
85
84
  next
@@ -255,7 +255,6 @@ class Puppet::Resource
255
255
  "Did you mean (#{(type[:type] || type["type"]).inspect}, #{(type[:title] || type["title"]).inspect }) ?"
256
256
  end
257
257
 
258
- environment = attributes[:environment]
259
258
  # In order to avoid an expensive search of 'known_resource_types" and
260
259
  # to obey/preserve the implementation of the resource's type - if the
261
260
  # given type is a resource type implementation (one of):
@@ -277,7 +276,7 @@ class Puppet::Resource
277
276
  end
278
277
  @exported = false
279
278
 
280
- # Set things like strictness first.
279
+ # Set things like environment, strictness first.
281
280
  attributes.each do |attr, value|
282
281
  next if attr == :parameters
283
282
  send(attr.to_s + "=", value)
@@ -144,7 +144,6 @@ module Puppet
144
144
  # Puppet::Transaction::Event failure with the given message.
145
145
  # @param message [String] the reason for a status failure
146
146
  def fail_with_event(message)
147
- failed = true
148
147
  add_event(@real_resource.event(:name => :resource_error, :status => "failure", :message => message))
149
148
  end
150
149