def _linux_cpudata():
 grains = {}
 cpuinfo = '/proc/cpuinfo'
 if os.path.isfile(cpuinfo):
  with salt.utils.fopen(cpuinfo, 'r') as _fp:
   for line in _fp:
    comps = line.split(':')
    if (not (len(comps) > 1)):
     continue
    key = comps[0].strip()
    val = comps[1].strip()
    if (key == 'processor'):
     grains['num_cpus'] = (int(val) + 1)
    elif (key == 'model name'):
     grains['cpu_model'] = val
    elif (key == 'flags'):
     grains['cpu_flags'] = val.split()
    elif (key == 'Features'):
     grains['cpu_flags'] = val.split()
    elif (key == 'Processor'):
     grains['cpu_model'] = val.split('-')[0]
     grains['num_cpus'] = 1
 if ('num_cpus' not in grains):
  grains['num_cpus'] = 0
 if ('cpu_model' not in grains):
  grains['cpu_model'] = 'Unknown'
 if ('cpu_flags' not in grains):
  grains['cpu_flags'] = []
 return grains

def _linux_cpudata ( ) : grains = { } cpuinfo = '/proc/cpuinfo' if os . path . isfile ( cpuinfo ) : with salt . utils . fopen ( cpuinfo , 'r' ) as _fp : for line in _fp : comps = line . split ( ':' ) if ( not ( len ( comps ) > 1 ) ) : continue key = comps [ 0 ] . strip ( ) val = comps [ 1 ] . strip ( ) if ( key == 'processor' ) : grains [ 'num_cpus' ] = ( int ( val ) + 1 ) elif ( key == 'model name' ) : grains [ 'cpu_model' ] = val elif ( key == 'flags' ) : grains [ 'cpu_flags' ] = val . split ( ) elif ( key == 'Features' ) : grains [ 'cpu_flags' ] = val . split ( ) elif ( key == 'Processor' ) : grains [ 'cpu_model' ] = val . split ( '-' ) [ 0 ] grains [ 'num_cpus' ] = 1 if ( 'num_cpus' not in grains ) : grains [ 'num_cpus' ] = 0 if ( 'cpu_model' not in grains ) : grains [ 'cpu_model' ] = 'Unknown' if ( 'cpu_flags' not in grains ) : grains [ 'cpu_flags' ] = [ ] return grains
return some cpu information for linux minions .