def delete_net_dev(dev):
 if device_exists(dev):
  try:
   utils.execute('ip', 'link', 'delete', dev, run_as_root=True, check_exit_code=[0, 2, 254])
   LOG.debug("Net device removed: '%s'", dev)
  except processutils.ProcessExecutionError:
   with excutils.save_and_reraise_exception():
    LOG.error(_LE("Failed removing net device: '%s'"), dev)

def delete_net_dev ( dev ) : if device_exists ( dev ) : try : utils . execute ( 'ip' , 'link' , 'delete' , dev , run_as_root = True , check_exit_code = [ 0 , 2 , 254 ] ) LOG . debug ( "Net device removed: '%s'" , dev ) except processutils . ProcessExecutionError : with excutils . save_and_reraise_exception ( ) : LOG . error ( _LE ( "Failed removing net device: '%s'" ) , dev )
delete a network device only if it exists .