def _netbsd_gpu_data():
 known_vendors = ['nvidia', 'amd', 'ati', 'intel', 'cirrus logic', 'vmware']
 gpus = []
 try:
  pcictl_out = __salt__['cmd.run']('pcictl pci0 list')
  for line in pcictl_out.splitlines():
   for vendor in known_vendors:
    vendor_match = re.match('[0-9:]+ ({0}) (.+) \\(VGA .+\\)'.format(vendor), line, re.IGNORECASE)
    if vendor_match:
     gpus.append({'vendor': vendor_match.group(1), 'model': vendor_match.group(2)})
 except OSError:
  pass
 grains = {}
 grains['num_gpus'] = len(gpus)
 grains['gpus'] = gpus
 return grains

def _netbsd_gpu_data ( ) : known_vendors = [ 'nvidia' , 'amd' , 'ati' , 'intel' , 'cirrus logic' , 'vmware' ] gpus = [ ] try : pcictl_out = __salt__ [ 'cmd.run' ] ( 'pcictl pci0 list' ) for line in pcictl_out . splitlines ( ) : for vendor in known_vendors : vendor_match = re . match ( '[0-9:]+ ({0}) (.+) \\(VGA .+\\)' . format ( vendor ) , line , re . IGNORECASE ) if vendor_match : gpus . append ( { 'vendor' : vendor_match . group ( 1 ) , 'model' : vendor_match . group ( 2 ) } ) except OSError : pass grains = { } grains [ 'num_gpus' ] = len ( gpus ) grains [ 'gpus' ] = gpus return grains
num_gpus: int gpus: - vendor: nvidia|amd|ati| .