# File lib/puppet/provider/package/openbsd.rb, line 13
13:     def self.instances
14:         packages = []
15: 
16:         begin
17:             execpipe(listcmd()) do |process|
18:                 # our regex for matching pkg_info output
19:                 regex = %r{^(\S+)-([^-\s]+)\s+(.+)}
20:                 fields = [:name, :ensure, :description]
21:                 hash = {}
22: 
23:                 # now turn each returned line into a package object
24:                 process.each { |line|
25:                     if match = regex.match(line)
26:                         fields.zip(match.captures) { |field,value|
27:                             hash[field] = value
28:                         }
29:                         yup = nil
30:                         name = hash[:name]
31: 
32:                         hash[:provider] = self.name
33: 
34:                         packages << new(hash)
35:                         hash = {}
36:                     else
37:                         # Print a warning on lines we can't match, but move
38:                         # on, since it should be non-fatal
39:                         warning("Failed to match line %s" % line)
40:                     end
41:                 }
42:             end
43: 
44:             return packages
45:         rescue Puppet::ExecutionFailure
46:             return nil
47:         end
48:     end