def delete_host(mac=None, name=None):
 if (not (mac or name)):
  raise TypeError('At least one argument is required')
 o = _conn()
 msg = omapi.OmapiMessage.open('host')
 if mac:
  msg.obj.append(('hardware-address', omapi.pack_mac(mac)))
  msg.obj.append(('hardware-type', struct.pack('!I', 1)))
 if name:
  msg.obj.append(('name', name))
 response = o.query_server(msg)
 if (response.opcode != omapi.OMAPI_OP_UPDATE):
  return None
 if (response.handle == 0):
  return False
 response = o.query_server(omapi.OmapiMessage.delete(response.handle))
 if (response.opcode != omapi.OMAPI_OP_STATUS):
  return False
 return True

def delete_host ( mac = None , name = None ) : if ( not ( mac or name ) ) : raise TypeError ( 'At least one argument is required' ) o = _conn ( ) msg = omapi . OmapiMessage . open ( 'host' ) if mac : msg . obj . append ( ( 'hardware-address' , omapi . pack_mac ( mac ) ) ) msg . obj . append ( ( 'hardware-type' , struct . pack ( '!I' , 1 ) ) ) if name : msg . obj . append ( ( 'name' , name ) ) response = o . query_server ( msg ) if ( response . opcode != omapi . OMAPI_OP_UPDATE ) : return None if ( response . handle == 0 ) : return False response = o . query_server ( omapi . OmapiMessage . delete ( response . handle ) ) if ( response . opcode != omapi . OMAPI_OP_STATUS ) : return False return True
delete the host with the given mac or name .