def is_enabled(iface):
 cmd = ['netsh', 'interface', 'show', 'interface', 'name={0}'.format(iface)]
 iface_found = False
 for line in __salt__['cmd.run'](cmd, python_shell=False).splitlines():
  if ('Connect state:' in line):
   iface_found = True
   return (line.split()[(-1)] == 'Connected')
 if (not iface_found):
  raise CommandExecutionError("Interface '{0}' not found".format(iface))
 return False

def is_enabled ( iface ) : cmd = [ 'netsh' , 'interface' , 'show' , 'interface' , 'name={0}' . format ( iface ) ] iface_found = False for line in __salt__ [ 'cmd.run' ] ( cmd , python_shell = False ) . splitlines ( ) : if ( 'Connect state:' in line ) : iface_found = True return ( line . split ( ) [ ( - 1 ) ] == 'Connected' ) if ( not iface_found ) : raise CommandExecutionError ( "Interface '{0}' not found" . format ( iface ) ) return False
list a job only if its enabled .