def _get_bufsize_linux(iface):
 ret = {'result': False}
 cmd = '/sbin/ethtool -g {0}'.format(iface)
 out = __salt__['cmd.run'](cmd)
 pat = re.compile('^(.+):\\s+(\\d+)$')
 suffix = 'max-'
 for line in out.splitlines():
  res = pat.match(line)
  if res:
   ret[(res.group(1).lower().replace(' ', '-') + suffix)] = int(res.group(2))
   ret['result'] = True
  elif line.endswith('maximums:'):
   suffix = '-max'
  elif line.endswith('settings:'):
   suffix = ''
 if (not ret['result']):
  parts = out.split()
  if parts[0].endswith('sh:'):
   out = ' '.join(parts[1:])
  ret['comment'] = out
 return ret

def _get_bufsize_linux ( iface ) : ret = { 'result' : False } cmd = '/sbin/ethtool -g {0}' . format ( iface ) out = __salt__ [ 'cmd.run' ] ( cmd ) pat = re . compile ( '^(.+):\\s+(\\d+)$' ) suffix = 'max-' for line in out . splitlines ( ) : res = pat . match ( line ) if res : ret [ ( res . group ( 1 ) . lower ( ) . replace ( ' ' , '-' ) + suffix ) ] = int ( res . group ( 2 ) ) ret [ 'result' ] = True elif line . endswith ( 'maximums:' ) : suffix = '-max' elif line . endswith ( 'settings:' ) : suffix = '' if ( not ret [ 'result' ] ) : parts = out . split ( ) if parts [ 0 ] . endswith ( 'sh:' ) : out = ' ' . join ( parts [ 1 : ] ) ret [ 'comment' ] = out return ret
return network interface buffer information using ethtool .