puppet 6.6.0-x86-mingw32 → 6.7.0-x86-mingw32

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

Potentially problematic release.


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

Files changed (254) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -8
  3. data/ext/solaris/smf/puppet.xml +2 -0
  4. data/ext/yaml_nodes.rb +7 -7
  5. data/lib/hiera_puppet.rb +2 -1
  6. data/lib/puppet/application/apply.rb +2 -3
  7. data/lib/puppet/application/doc.rb +2 -1
  8. data/lib/puppet/application/face_base.rb +22 -15
  9. data/lib/puppet/application/script.rb +4 -6
  10. data/lib/puppet/configurer.rb +10 -5
  11. data/lib/puppet/confine_collection.rb +2 -1
  12. data/lib/puppet/daemon.rb +3 -2
  13. data/lib/puppet/defaults.rb +8 -0
  14. data/lib/puppet/environments.rb +9 -7
  15. data/lib/puppet/etc.rb +1 -1
  16. data/lib/puppet/external/pson/pure/parser.rb +2 -1
  17. data/lib/puppet/face/epp.rb +4 -2
  18. data/lib/puppet/face/help.rb +3 -2
  19. data/lib/puppet/face/module/changes.rb +2 -1
  20. data/lib/puppet/file_bucket/dipper.rb +2 -1
  21. data/lib/puppet/file_serving/configuration.rb +2 -1
  22. data/lib/puppet/file_serving/fileset.rb +1 -1
  23. data/lib/puppet/file_serving/http_metadata.rb +4 -2
  24. data/lib/puppet/file_serving/metadata.rb +2 -1
  25. data/lib/puppet/file_serving/mount/file.rb +2 -1
  26. data/lib/puppet/file_serving/mount/locales.rb +2 -1
  27. data/lib/puppet/file_serving/mount/modules.rb +4 -2
  28. data/lib/puppet/file_serving/mount/pluginfacts.rb +2 -1
  29. data/lib/puppet/file_serving/mount/plugins.rb +2 -1
  30. data/lib/puppet/file_serving/mount/tasks.rb +4 -2
  31. data/lib/puppet/file_system/uniquefile.rb +4 -2
  32. data/lib/puppet/functions/match.rb +2 -3
  33. data/lib/puppet/generate/type.rb +2 -1
  34. data/lib/puppet/graph/relationship_graph.rb +2 -1
  35. data/lib/puppet/graph/simple_graph.rb +3 -2
  36. data/lib/puppet/indirector/catalog/compiler.rb +16 -8
  37. data/lib/puppet/indirector/certificate/rest.rb +2 -1
  38. data/lib/puppet/indirector/face.rb +2 -2
  39. data/lib/puppet/indirector/file_server.rb +4 -2
  40. data/lib/puppet/indirector/indirection.rb +12 -6
  41. data/lib/puppet/indirector/node/exec.rb +2 -1
  42. data/lib/puppet/indirector/report/processor.rb +2 -1
  43. data/lib/puppet/indirector/request.rb +9 -5
  44. data/lib/puppet/indirector/ssl_file.rb +10 -8
  45. data/lib/puppet/indirector/terminus.rb +6 -3
  46. data/lib/puppet/info_service.rb +9 -0
  47. data/lib/puppet/info_service/plan_information_service.rb +36 -0
  48. data/lib/puppet/interface.rb +2 -1
  49. data/lib/puppet/interface/action.rb +10 -5
  50. data/lib/puppet/interface/action_manager.rb +2 -1
  51. data/lib/puppet/interface/documentation.rb +10 -7
  52. data/lib/puppet/interface/face_collection.rb +6 -3
  53. data/lib/puppet/interface/option.rb +4 -2
  54. data/lib/puppet/interface/option_manager.rb +4 -2
  55. data/lib/puppet/module.rb +35 -1
  56. data/lib/puppet/module/plan.rb +160 -0
  57. data/lib/puppet/module_tool.rb +2 -1
  58. data/lib/puppet/module_tool/applications/application.rb +2 -1
  59. data/lib/puppet/module_tool/applications/installer.rb +4 -2
  60. data/lib/puppet/module_tool/applications/upgrader.rb +4 -2
  61. data/lib/puppet/module_tool/contents_description.rb +2 -1
  62. data/lib/puppet/module_tool/metadata.rb +2 -3
  63. data/lib/puppet/module_tool/shared_behaviors.rb +2 -1
  64. data/lib/puppet/network/authconfig.rb +4 -2
  65. data/lib/puppet/network/authstore.rb +2 -1
  66. data/lib/puppet/network/formats.rb +2 -1
  67. data/lib/puppet/network/http/api/indirected_routes.rb +6 -4
  68. data/lib/puppet/network/http/handler.rb +2 -1
  69. data/lib/puppet/network/http/request.rb +2 -1
  70. data/lib/puppet/network/http/route.rb +2 -1
  71. data/lib/puppet/network/resolver.rb +3 -2
  72. data/lib/puppet/network/rights.rb +2 -1
  73. data/lib/puppet/node.rb +8 -4
  74. data/lib/puppet/pal/catalog_compiler.rb +8 -1
  75. data/lib/puppet/pal/compiler.rb +2 -1
  76. data/lib/puppet/pal/pal_impl.rb +8 -0
  77. data/lib/puppet/pal/script_compiler.rb +4 -2
  78. data/lib/puppet/parameter.rb +4 -2
  79. data/lib/puppet/parameter/value_collection.rb +8 -8
  80. data/lib/puppet/parser/ast/pops_bridge.rb +2 -1
  81. data/lib/puppet/parser/compiler.rb +10 -5
  82. data/lib/puppet/parser/files.rb +2 -1
  83. data/lib/puppet/parser/functions.rb +2 -1
  84. data/lib/puppet/parser/relationship.rb +2 -1
  85. data/lib/puppet/parser/resource.rb +6 -3
  86. data/lib/puppet/parser/scope.rb +6 -4
  87. data/lib/puppet/parser/templatewrapper.rb +2 -1
  88. data/lib/puppet/parser/type_loader.rb +2 -1
  89. data/lib/puppet/pops/adaptable.rb +2 -5
  90. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +2 -1
  91. data/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +2 -1
  92. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
  93. data/lib/puppet/pops/evaluator/runtime3_support.rb +8 -4
  94. data/lib/puppet/pops/loader/base_loader.rb +4 -2
  95. data/lib/puppet/pops/loader/dependency_loader.rb +4 -2
  96. data/lib/puppet/pops/loader/gem_support.rb +4 -2
  97. data/lib/puppet/pops/loader/loader.rb +4 -2
  98. data/lib/puppet/pops/loader/loader_paths.rb +2 -1
  99. data/lib/puppet/pops/loader/static_loader.rb +1 -1
  100. data/lib/puppet/pops/lookup/interpolation.rb +2 -1
  101. data/lib/puppet/pops/model/factory.rb +4 -2
  102. data/lib/puppet/pops/parser/epp_support.rb +2 -1
  103. data/lib/puppet/pops/parser/heredoc_support.rb +2 -1
  104. data/lib/puppet/pops/parser/interpolation_support.rb +10 -5
  105. data/lib/puppet/pops/parser/lexer2.rb +6 -3
  106. data/lib/puppet/pops/parser/locator.rb +2 -1
  107. data/lib/puppet/pops/types/type_calculator.rb +1 -1
  108. data/lib/puppet/pops/types/type_parser.rb +4 -2
  109. data/lib/puppet/pops/validation.rb +2 -1
  110. data/lib/puppet/pops/validation/checker4_0.rb +6 -3
  111. data/lib/puppet/pops/visitor.rb +12 -6
  112. data/lib/puppet/property.rb +19 -16
  113. data/lib/puppet/property/ensure.rb +2 -1
  114. data/lib/puppet/property/keyvalue.rb +2 -1
  115. data/lib/puppet/property/list.rb +2 -1
  116. data/lib/puppet/provider.rb +10 -8
  117. data/lib/puppet/provider/exec.rb +7 -4
  118. data/lib/puppet/provider/file/posix.rb +6 -3
  119. data/lib/puppet/provider/group/groupadd.rb +2 -1
  120. data/lib/puppet/provider/group/ldap.rb +7 -4
  121. data/lib/puppet/provider/group/pw.rb +4 -2
  122. data/lib/puppet/provider/ldap.rb +8 -4
  123. data/lib/puppet/provider/nameservice.rb +8 -5
  124. data/lib/puppet/provider/nameservice/directoryservice.rb +8 -4
  125. data/lib/puppet/provider/network_device.rb +4 -2
  126. data/lib/puppet/provider/package.rb +2 -1
  127. data/lib/puppet/provider/package/aix.rb +4 -2
  128. data/lib/puppet/provider/package/appdmg.rb +4 -2
  129. data/lib/puppet/provider/package/apple.rb +2 -1
  130. data/lib/puppet/provider/package/apt.rb +4 -2
  131. data/lib/puppet/provider/package/blastwave.rb +2 -1
  132. data/lib/puppet/provider/package/dpkg.rb +6 -3
  133. data/lib/puppet/provider/package/fink.rb +2 -1
  134. data/lib/puppet/provider/package/gem.rb +4 -2
  135. data/lib/puppet/provider/package/macports.rb +6 -3
  136. data/lib/puppet/provider/package/nim.rb +8 -4
  137. data/lib/puppet/provider/package/openbsd.rb +14 -8
  138. data/lib/puppet/provider/package/opkg.rb +2 -1
  139. data/lib/puppet/provider/package/pacman.rb +2 -1
  140. data/lib/puppet/provider/package/pip.rb +2 -1
  141. data/lib/puppet/provider/package/pkgdmg.rb +4 -2
  142. data/lib/puppet/provider/package/pkgng.rb +4 -2
  143. data/lib/puppet/provider/package/pkgutil.rb +2 -1
  144. data/lib/puppet/provider/package/portupgrade.rb +2 -1
  145. data/lib/puppet/provider/package/rpm.rb +8 -4
  146. data/lib/puppet/provider/package/windows/package.rb +2 -1
  147. data/lib/puppet/provider/parsedfile.rb +14 -7
  148. data/lib/puppet/provider/service/base.rb +7 -4
  149. data/lib/puppet/provider/service/launchd.rb +4 -2
  150. data/lib/puppet/provider/service/service.rb +2 -1
  151. data/lib/puppet/provider/service/upstart.rb +11 -8
  152. data/lib/puppet/provider/user/directoryservice.rb +2 -1
  153. data/lib/puppet/provider/user/hpux.rb +1 -1
  154. data/lib/puppet/provider/user/ldap.rb +8 -4
  155. data/lib/puppet/provider/user/openbsd.rb +2 -1
  156. data/lib/puppet/provider/user/pw.rb +2 -1
  157. data/lib/puppet/provider/user/user_role_add.rb +4 -2
  158. data/lib/puppet/provider/user/useradd.rb +7 -4
  159. data/lib/puppet/reference/providers.rb +2 -3
  160. data/lib/puppet/reference/type.rb +4 -2
  161. data/lib/puppet/relationship.rb +4 -9
  162. data/lib/puppet/resource.rb +16 -9
  163. data/lib/puppet/resource/capability_finder.rb +12 -8
  164. data/lib/puppet/resource/catalog.rb +36 -40
  165. data/lib/puppet/resource/type.rb +7 -3
  166. data/lib/puppet/resource/type_collection.rb +4 -2
  167. data/lib/puppet/settings.rb +36 -19
  168. data/lib/puppet/settings/base_setting.rb +2 -1
  169. data/lib/puppet/settings/config_file.rb +2 -1
  170. data/lib/puppet/settings/file_setting.rb +2 -1
  171. data/lib/puppet/settings/ini_file.rb +2 -1
  172. data/lib/puppet/ssl/base.rb +2 -1
  173. data/lib/puppet/ssl/host.rb +16 -8
  174. data/lib/puppet/ssl/key.rb +2 -2
  175. data/lib/puppet/ssl/state_machine.rb +22 -3
  176. data/lib/puppet/transaction/event.rb +2 -1
  177. data/lib/puppet/transaction/event_manager.rb +4 -2
  178. data/lib/puppet/transaction/report.rb +10 -10
  179. data/lib/puppet/transaction/resource_harness.rb +4 -2
  180. data/lib/puppet/type.rb +84 -48
  181. data/lib/puppet/type/component.rb +2 -1
  182. data/lib/puppet/type/exec.rb +11 -7
  183. data/lib/puppet/type/file.rb +15 -9
  184. data/lib/puppet/type/file/content.rb +7 -3
  185. data/lib/puppet/type/file/ctime.rb +2 -1
  186. data/lib/puppet/type/file/data_sync.rb +2 -1
  187. data/lib/puppet/type/file/ensure.rb +10 -7
  188. data/lib/puppet/type/file/mode.rb +2 -1
  189. data/lib/puppet/type/file/mtime.rb +2 -1
  190. data/lib/puppet/type/file/selcontext.rb +2 -1
  191. data/lib/puppet/type/file/source.rb +6 -7
  192. data/lib/puppet/type/file/target.rb +2 -1
  193. data/lib/puppet/type/file/type.rb +2 -1
  194. data/lib/puppet/type/package.rb +6 -3
  195. data/lib/puppet/type/resources.rb +2 -1
  196. data/lib/puppet/type/service.rb +2 -1
  197. data/lib/puppet/type/tidy.rb +14 -7
  198. data/lib/puppet/type/user.rb +19 -7
  199. data/lib/puppet/util.rb +6 -3
  200. data/lib/puppet/util/checksums.rb +1 -1
  201. data/lib/puppet/util/classgen.rb +12 -6
  202. data/lib/puppet/util/command_line.rb +8 -4
  203. data/lib/puppet/util/connection.rb +4 -2
  204. data/lib/puppet/util/diff.rb +4 -2
  205. data/lib/puppet/util/execution.rb +4 -2
  206. data/lib/puppet/util/feature.rb +7 -4
  207. data/lib/puppet/util/fileparsing.rb +57 -46
  208. data/lib/puppet/util/filetype.rb +2 -1
  209. data/lib/puppet/util/http_proxy.rb +2 -1
  210. data/lib/puppet/util/instance_loader.rb +2 -1
  211. data/lib/puppet/util/ldap/connection.rb +4 -2
  212. data/lib/puppet/util/ldap/manager.rb +6 -3
  213. data/lib/puppet/util/log.rb +6 -3
  214. data/lib/puppet/util/metric.rb +2 -1
  215. data/lib/puppet/util/posix.rb +4 -2
  216. data/lib/puppet/util/rdoc/code_objects.rb +2 -1
  217. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +4 -2
  218. data/lib/puppet/util/selinux.rb +2 -1
  219. data/lib/puppet/version.rb +2 -5
  220. data/locales/puppet.pot +713 -685
  221. data/man/man5/puppet.conf.5 +9 -2
  222. data/man/man8/puppet-agent.8 +1 -1
  223. data/man/man8/puppet-apply.8 +1 -1
  224. data/man/man8/puppet-catalog.8 +1 -1
  225. data/man/man8/puppet-config.8 +1 -1
  226. data/man/man8/puppet-describe.8 +1 -1
  227. data/man/man8/puppet-device.8 +1 -1
  228. data/man/man8/puppet-doc.8 +1 -1
  229. data/man/man8/puppet-epp.8 +1 -1
  230. data/man/man8/puppet-facts.8 +1 -1
  231. data/man/man8/puppet-filebucket.8 +1 -1
  232. data/man/man8/puppet-generate.8 +1 -1
  233. data/man/man8/puppet-help.8 +1 -1
  234. data/man/man8/puppet-key.8 +1 -1
  235. data/man/man8/puppet-lookup.8 +1 -1
  236. data/man/man8/puppet-man.8 +1 -1
  237. data/man/man8/puppet-module.8 +1 -1
  238. data/man/man8/puppet-node.8 +1 -1
  239. data/man/man8/puppet-parser.8 +1 -1
  240. data/man/man8/puppet-plugin.8 +1 -1
  241. data/man/man8/puppet-report.8 +1 -1
  242. data/man/man8/puppet-resource.8 +1 -1
  243. data/man/man8/puppet-script.8 +1 -1
  244. data/man/man8/puppet-ssl.8 +1 -1
  245. data/man/man8/puppet-status.8 +1 -1
  246. data/man/man8/puppet.8 +2 -2
  247. data/spec/lib/puppet_spec/modules.rb +16 -2
  248. data/spec/unit/indirector/request_spec.rb +5 -6
  249. data/spec/unit/info_service_spec.rb +48 -0
  250. data/spec/unit/module_spec.rb +73 -0
  251. data/spec/unit/plan_spec.rb +65 -0
  252. data/spec/unit/puppet_pal_catalog_spec.rb +12 -0
  253. data/spec/unit/ssl/state_machine_spec.rb +68 -5
  254. metadata +6 -2
@@ -313,10 +313,13 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
313
313
  # have a string and need to convert it to a number
314
314
  if @resource.should(name)
315
315
  @resource.property(name).sync
316
- elsif value = autogen(name)
317
- self.send(name.to_s + "=", value)
318
316
  else
319
- next
317
+ value = autogen(name)
318
+ if value
319
+ self.send(name.to_s + "=", value)
320
+ else
321
+ next
322
+ end
320
323
  end
321
324
  end
322
325
  end
@@ -393,7 +396,8 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
393
396
  fail(_("Could not set GeneratedUID for %{resource} %{name}: %{detail}") % { resource: @resource.class.name, name: @resource.name, detail: detail })
394
397
  end
395
398
 
396
- if value = @resource.should(:password) and value != ""
399
+ value = @resource.should(:password)
400
+ if value && value != ""
397
401
  self.class.set_password(@resource[:name], guid, value)
398
402
  end
399
403
 
@@ -13,7 +13,8 @@ class Puppet::Provider::NetworkDevice < Puppet::Provider
13
13
  def self.prefetch(resources)
14
14
  resources.each do |name, resource|
15
15
  device = Puppet::Util::NetworkDevice.current || device(resource[:device_url])
16
- if result = lookup(device, name)
16
+ result = lookup(device, name)
17
+ if result
17
18
  result[:ensure] = :present
18
19
  resource.provider = new(device, result)
19
20
  else
@@ -45,7 +46,8 @@ class Puppet::Provider::NetworkDevice < Puppet::Provider
45
46
  def create
46
47
  @property_hash[:ensure] = :present
47
48
  self.class.resource_type.validproperties.each do |property|
48
- if val = resource.should(property)
49
+ val = resource.should(property)
50
+ if val
49
51
  @property_hash[property] = val
50
52
  end
51
53
  end
@@ -4,7 +4,8 @@ class Puppet::Provider::Package < Puppet::Provider
4
4
  # Prefetch our package list, yo.
5
5
  def self.prefetch(packages)
6
6
  instances.each do |prov|
7
- if pkg = packages[prov.name]
7
+ pkg = packages[prov.name]
8
+ if pkg
8
9
  pkg.provider = prov
9
10
  end
10
11
  end
@@ -81,7 +81,8 @@ Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package d
81
81
  end
82
82
 
83
83
  def install(useversion = true)
84
- unless source = @resource[:source]
84
+ source = @resource[:source]
85
+ unless source
85
86
  self.fail _("A directory is required which will be used to find packages")
86
87
  end
87
88
 
@@ -101,7 +102,8 @@ Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package d
101
102
  def self.pkglist(hash = {})
102
103
  cmd = [command(:lslpp), "-qLc"]
103
104
 
104
- if name = hash[:pkgname]
105
+ name = hash[:pkgname]
106
+ if name
105
107
  cmd << name
106
108
  end
107
109
 
@@ -98,10 +98,12 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Packag
98
98
  end
99
99
 
100
100
  def install
101
- unless source = @resource[:source]
101
+ source = @resource[:source]
102
+ unless source
102
103
  self.fail _("Mac OS X PKG DMGs must specify a package source.")
103
104
  end
104
- unless name = @resource[:name]
105
+ name = @resource[:name]
106
+ unless name
105
107
  self.fail _("Mac OS X PKG DMGs must specify a package name.")
106
108
  end
107
109
  self.class.installpkgdmg(source,name)
@@ -37,7 +37,8 @@ Puppet::Type.type(:package).provide :apple, :parent => Puppet::Provider::Package
37
37
  end
38
38
 
39
39
  def install
40
- unless source = @resource[:source]
40
+ source = @resource[:source]
41
+ unless source
41
42
  self.fail _("Mac OS X packages must specify a package source")
42
43
  end
43
44
 
@@ -49,7 +49,8 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
49
49
  checkforcdrom
50
50
  cmd = %w{-q -y}
51
51
 
52
- if config = @resource[:configfiles]
52
+ config = @resource[:configfiles]
53
+ if config
53
54
  if config == :keep
54
55
  cmd << "-o" << 'DPkg::Options::=--force-confold'
55
56
  else
@@ -89,7 +90,8 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
89
90
  # preseeds answers to dpkg-set-selection from the "responsefile"
90
91
  #
91
92
  def run_preseed
92
- if response = @resource[:responsefile] and Puppet::FileSystem.exist?(response)
93
+ response = @resource[:responsefile]
94
+ if response && Puppet::FileSystem.exist?(response)
93
95
  self.info(_("Preseeding %{response} to debconf-set-selections") % { response: response })
94
96
 
95
97
  preseed response
@@ -93,7 +93,8 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
93
93
  end
94
94
 
95
95
  def query
96
- if hash = self.class.blastlist(:justme => @resource[:name])
96
+ hash = self.class.blastlist(:justme => @resource[:name])
97
+ if hash
97
98
  hash
98
99
  else
99
100
  {:ensure => :absent}
@@ -30,7 +30,8 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
30
30
  dpkgquery_piped('-W', '--showformat', self::DPKG_QUERY_FORMAT_STRING) do |pipe|
31
31
  # now turn each returned line into a package object
32
32
  pipe.each_line do |line|
33
- if hash = parse_line(line)
33
+ hash = parse_line(line)
34
+ if hash
34
35
  packages << new(hash)
35
36
  end
36
37
  end
@@ -53,7 +54,8 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
53
54
  def self.parse_line(line)
54
55
  hash = nil
55
56
 
56
- if match = self::FIELDS_REGEX.match(line)
57
+ match = self::FIELDS_REGEX.match(line)
58
+ if match
57
59
  hash = {}
58
60
 
59
61
  self::FIELDS.zip(match.captures) do |field,value|
@@ -78,7 +80,8 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
78
80
  public
79
81
 
80
82
  def install
81
- unless file = @resource[:source]
83
+ file = @resource[:source]
84
+ unless file
82
85
  raise ArgumentError, _("You cannot install dpkg packages without a source")
83
86
  end
84
87
  args = []
@@ -56,7 +56,8 @@ Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do
56
56
  # preseeds answers to dpkg-set-selection from the "responsefile"
57
57
  #
58
58
  def run_preseed
59
- if response = @resource[:responsefile] and Puppet::FileSystem.exist?(response)
59
+ response = @resource[:responsefile]
60
+ if response && Puppet::FileSystem.exist?(response)
60
61
  self.info(_("Preseeding %{response} to debconf-set-selections") % { response: response })
61
62
 
62
63
  preseed response
@@ -82,7 +82,8 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package::
82
82
  if options[:source]
83
83
  command_options << "--source" << options[:source]
84
84
  end
85
- if name = options[:justme]
85
+ name = options[:justme]
86
+ if name
86
87
  command_options << '\A' + name + '\z'
87
88
  end
88
89
 
@@ -161,7 +162,8 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package::
161
162
  command_options << "--no-document"
162
163
  end
163
164
 
164
- if source = resource[:source]
165
+ source = resource[:source]
166
+ if source
165
167
  begin
166
168
  uri = URI.parse(source)
167
169
  rescue => detail
@@ -38,7 +38,8 @@ Puppet::Type.type(:package).provide :macports, :parent => Puppet::Provider::Pack
38
38
 
39
39
  def self.hash_from_line(line, regex, fields)
40
40
  hash = {}
41
- if match = regex.match(line)
41
+ match = regex.match(line)
42
+ if match
42
43
  fields.zip(match.captures) { |field, value|
43
44
  hash[field] = value
44
45
  }
@@ -51,7 +52,8 @@ Puppet::Type.type(:package).provide :macports, :parent => Puppet::Provider::Pack
51
52
  def self.instances
52
53
  packages = []
53
54
  port("-q", :installed).each_line do |line|
54
- if hash = parse_installed_query_line(line)
55
+ hash = parse_installed_query_line(line)
56
+ if hash
55
57
  packages << new(hash)
56
58
  end
57
59
  end
@@ -82,7 +84,8 @@ Puppet::Type.type(:package).provide :macports, :parent => Puppet::Provider::Pack
82
84
  info_line = execute([command(:port), "-q", :info, "--line", "--version", "--revision", @resource[:name]], :failonfail => false, :combine => false)
83
85
  return nil if info_line == ""
84
86
 
85
- if newest = self.class.parse_info_query_line(info_line)
87
+ newest = self.class.parse_info_query_line(info_line)
88
+ if newest
86
89
  current = query
87
90
  # We're doing some fiddling behind the scenes here to cope with updated revisions.
88
91
  # If we're already at the latest version/revision, then just return the version
@@ -55,7 +55,8 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
55
55
  end
56
56
 
57
57
  def install(useversion = true)
58
- unless source = @resource[:source]
58
+ source = @resource[:source]
59
+ unless source
59
60
  self.fail _("An LPP source location is required in 'source'")
60
61
  end
61
62
 
@@ -213,7 +214,8 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
213
214
  end
214
215
 
215
216
  def parse_installp_package_string(package_string)
216
- unless match = package_string.match(self.class::INSTALLP_PACKAGE_REGEX)
217
+ match = package_string.match(self.class::INSTALLP_PACKAGE_REGEX)
218
+ unless match
217
219
  self.fail _("Unable to parse output from nimclient showres: package string does not match expected installp package string format:\n'%{package_string}'") % { package_string: package_string }
218
220
  end
219
221
  package_name = match.captures[0]
@@ -222,7 +224,8 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
222
224
  end
223
225
 
224
226
  def parse_rpm_package_string(package_string)
225
- unless match = package_string.match(self.class::RPM_PACKAGE_REGEX)
227
+ match = package_string.match(self.class::RPM_PACKAGE_REGEX)
228
+ unless match
226
229
  self.fail _("Unable to parse output from nimclient showres: package string does not match expected rpm package string format:\n'%{package_string}'") % { package_string: package_string }
227
230
  end
228
231
  package_name = match.captures[0]
@@ -231,7 +234,8 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
231
234
  end
232
235
 
233
236
  def parse_showres_package_line(line)
234
- unless match = line.match(self.class::PACKAGE_LINE_REGEX)
237
+ match = line.match(self.class::PACKAGE_LINE_REGEX)
238
+ unless match
235
239
  self.fail _("Unable to parse output from nimclient showres: line does not match expected package line format:\n'%{line}'") % { line: line }
236
240
  end
237
241
 
@@ -33,7 +33,8 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa
33
33
 
34
34
  # now turn each returned line into a package object
35
35
  process.each_line { |line|
36
- if match = regex.match(line.split[0])
36
+ match = regex.match(line.split[0])
37
+ if match
37
38
  fields.zip(match.captures) { |field,value|
38
39
  hash[field] = value
39
40
  }
@@ -120,13 +121,17 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa
120
121
  unless @resource[:source]
121
122
  if Puppet::FileSystem.exist?("/etc/pkg.conf")
122
123
  File.open("/etc/pkg.conf", "rb").readlines.each do |line|
123
- if matchdata = line.match(/^installpath\s*=\s*(.+)\s*$/i)
124
+ matchdata = line.match(/^installpath\s*=\s*(.+)\s*$/i)
125
+ if matchdata
124
126
  @resource[:source] = matchdata[1]
125
- elsif matchdata = line.match(/^installpath\s*\+=\s*(.+)\s*$/i)
126
- if @resource[:source].nil?
127
- @resource[:source] = matchdata[1]
128
- else
129
- @resource[:source] += ":" + matchdata[1]
127
+ else
128
+ matchdata = line.match(/^installpath\s*\+=\s*(.+)\s*$/i)
129
+ if matchdata
130
+ if @resource[:source].nil?
131
+ @resource[:source] = matchdata[1]
132
+ else
133
+ @resource[:source] += ":" + matchdata[1]
134
+ end
130
135
  end
131
136
  end
132
137
  end
@@ -198,7 +203,8 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa
198
203
  version = -1
199
204
 
200
205
  process.each_line do |line|
201
- if match = regex.match(line.split[0])
206
+ match = regex.match(line.split[0])
207
+ if match
202
208
  # now we return the first version, unless ensure is latest
203
209
  version = match.captures[1]
204
210
  return version unless @resource[:ensure] == "latest"
@@ -16,7 +16,8 @@ Puppet::Type.type(:package).provide :opkg, :source => :opkg, :parent => Puppet::
16
16
  hash = {}
17
17
 
18
18
  process.each_line { |line|
19
- if match = regex.match(line)
19
+ match = regex.match(line)
20
+ if match
20
21
  fields.zip(match.captures) { |field,value| hash[field] = value }
21
22
  hash[:provider] = self.name
22
23
  packages << new(hash)
@@ -78,7 +78,8 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
78
78
  # pacman -Q output is 'packagename version-rel'
79
79
  regex = %r{^(\S+)\s(\S+)}
80
80
  pipe.each_line do |line|
81
- if match = regex.match(line)
81
+ match = regex.match(line)
82
+ if match
82
83
  packages[match.captures[0]] = match.captures[1]
83
84
  else
84
85
  warning(_("Failed to match line '%{line}'") % { line: line })
@@ -69,7 +69,8 @@ Puppet::Type.type(:package).provide :pip, :parent => ::Puppet::Provider::Package
69
69
 
70
70
  execpipe [command, command_options] do |process|
71
71
  process.collect do |line|
72
- next unless pkg = parse(line)
72
+ pkg = parse(line)
73
+ next unless pkg
73
74
  pkg[:command] = command
74
75
  packages << new(pkg)
75
76
  end
@@ -140,10 +140,12 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
140
140
  end
141
141
 
142
142
  def install
143
- unless source = @resource[:source]
143
+ source = @resource[:source]
144
+ unless source
144
145
  raise Puppet::Error.new(_("Mac OS X PKG DMGs must specify a package source."))
145
146
  end
146
- unless name = @resource[:name]
147
+ name = @resource[:name]
148
+ unless name
147
149
  raise Puppet::Error.new(_("Mac OS X PKG DMGs must specify a package name."))
148
150
  end
149
151
  self.class.installpkgdmg(source,name)
@@ -29,7 +29,8 @@ Puppet::Type.type(:package).provide :pkgng, :parent => Puppet::Provider::Package
29
29
  end
30
30
 
31
31
  def self.get_latest_version(origin)
32
- if latest_version = cached_version_list.lines.find { |l| l =~ /^#{origin} / }
32
+ latest_version = cached_version_list.lines.find { |l| l =~ /^#{origin} / }
33
+ if latest_version
33
34
  latest_version = latest_version.split(' ').last.split(')').first
34
35
  return latest_version
35
36
  end
@@ -74,7 +75,8 @@ Puppet::Type.type(:package).provide :pkgng, :parent => Puppet::Provider::Package
74
75
  def self.prefetch(resources)
75
76
  packages = instances
76
77
  resources.each_key do |name|
77
- if provider = packages.find{|p| p.name == name or p.origin == name }
78
+ provider = packages.find{|p| p.name == name or p.origin == name }
79
+ if provider
78
80
  resources[name].provider = provider
79
81
  end
80
82
  end
@@ -169,7 +169,8 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
169
169
  end
170
170
 
171
171
  def query
172
- if hash = pkgsingle(@resource)
172
+ hash = pkgsingle(@resource)
173
+ if hash
173
174
  hash
174
175
  else
175
176
  {:ensure => :absent}
@@ -52,7 +52,8 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
52
52
  output.split("\n").each { |data|
53
53
  # reset hash to nil for each line
54
54
  hash.clear
55
- if match = regex.match(data)
55
+ match = regex.match(data)
56
+ if match
56
57
  # Output matched regex
57
58
  fields.zip(match.captures) { |field, value|
58
59
  hash[field] = value
@@ -126,7 +126,8 @@ These options should be specified as an array where each element is either a str
126
126
 
127
127
  # Here we just retrieve the version from the file specified in the source.
128
128
  def latest
129
- unless source = @resource[:source]
129
+ source = @resource[:source]
130
+ unless source
130
131
  @resource.fail _("RPMs must specify a package source")
131
132
  end
132
133
 
@@ -138,7 +139,8 @@ These options should be specified as an array where each element is either a str
138
139
  end
139
140
 
140
141
  def install
141
- unless source = @resource[:source]
142
+ source = @resource[:source]
143
+ unless source
142
144
  @resource.fail _("RPMs must specify a package source")
143
145
  end
144
146
 
@@ -333,7 +335,8 @@ These options should be specified as an array where each element is either a str
333
335
  if ri
334
336
  v = s[0,ri]
335
337
  r = s[ri+1,s.length]
336
- if arch = r.scan(ARCH_REGEX)[0]
338
+ arch = r.scan(ARCH_REGEX)[0]
339
+ if arch
337
340
  a = arch.gsub(/\./, '')
338
341
  r.gsub!(ARCH_REGEX, '')
339
342
  end
@@ -401,7 +404,8 @@ These options should be specified as an array where each element is either a str
401
404
  line.strip!
402
405
  hash = {}
403
406
 
404
- if match = self::NEVRA_REGEX.match(line)
407
+ match = self::NEVRA_REGEX.match(line)
408
+ if match
405
409
  self::NEVRA_FIELDS.zip(match.captures) { |f, v| hash[f] = v }
406
410
  hash[:provider] = self.name
407
411
  hash[:ensure] = "#{hash[:version]}-#{hash[:release]}"
@@ -26,7 +26,8 @@ class Puppet::Provider::Package::Windows
26
26
  name = key.name.match(/^.+\\([^\\]+)$/).captures[0]
27
27
 
28
28
  [MsiPackage, ExePackage].find do |klass|
29
- if pkg = klass.from_registry(name, values)
29
+ pkg = klass.from_registry(name, values)
30
+ if pkg
30
31
  yield pkg
31
32
  end
32
33
  end