def list_nictags(include_etherstubs=True):
 ret = {}
 nictagadm = _check_nictagadm()
 cmd = '{nictagadm} list -d "|" -p{estubs}'.format(nictagadm=nictagadm, estubs=(' -L' if (not include_etherstubs) else ''))
 res = __salt__['cmd.run_all'](cmd)
 retcode = res['retcode']
 if (retcode != 0):
  ret['Error'] = (res['stderr'] if ('stderr' in res) else 'Failed to get list of nictags.')
 else:
  header = ['name', 'macaddress', 'link', 'type']
  for nictag in res['stdout'].splitlines():
   nictag = nictag.split('|')
   nictag_data = {}
   for field in header:
    nictag_data[field] = nictag[header.index(field)]
   ret[nictag_data['name']] = nictag_data
   del ret[nictag_data['name']]['name']
 return ret

def list_nictags ( include_etherstubs = True ) : ret = { } nictagadm = _check_nictagadm ( ) cmd = '{nictagadm} list -d "|" -p{estubs}' . format ( nictagadm = nictagadm , estubs = ( ' -L' if ( not include_etherstubs ) else '' ) ) res = __salt__ [ 'cmd.run_all' ] ( cmd ) retcode = res [ 'retcode' ] if ( retcode != 0 ) : ret [ 'Error' ] = ( res [ 'stderr' ] if ( 'stderr' in res ) else 'Failed to get list of nictags.' ) else : header = [ 'name' , 'macaddress' , 'link' , 'type' ] for nictag in res [ 'stdout' ] . splitlines ( ) : nictag = nictag . split ( '|' ) nictag_data = { } for field in header : nictag_data [ field ] = nictag [ header . index ( field ) ] ret [ nictag_data [ 'name' ] ] = nictag_data del ret [ nictag_data [ 'name' ] ] [ 'name' ] return ret
list all nictags include_etherstubs : boolean toggle include of etherstubs cli example: .