# File lib/puppet/provider/package/portupgrade.rb, line 177
177:     def query
178:       Puppet.debug "portupgrade.query() - Called on #{@resource[:name]}"
179: 
180:       cmdline = ["-qO", @resource[:name]]
181:       begin
182:         output = portinfo(*cmdline)
183:         rescue Puppet::ExecutionFailure
184:           raise Puppet::Error.new(output)
185:         end
186: 
187:         # Check: if output isn't in the right format, return nil
188:         if output =~ /^(\S+)-([^-\s]+)/
189:         #         Fill in the details
190:         hash = Hash.new
191:         hash[:portorigin]       = self.name
192:         hash[:portname]         = $1
193:         hash[:ensure]           = $2
194: 
195:         # If more details are required, then we can do another pkg_info query here
196:         # and parse out that output and add to the hash
197: 
198:         # return the hash to the caller
199:         return hash
200:         else
201:           Puppet.debug "portupgrade.query() - package (#{@resource[:name]}) not installed"
202:           return nil
203:         end
204: 
205:     end