Get host record by MAC address.
(self, mac: str)
| 890 | |
| 891 | if cursor.rowcount > 0: |
| 892 | logger.info(f"Deleted host: {mac}") |
| 893 | return True |
| 894 | else: |
| 895 | logger.debug(f"No host found to delete: {mac}") |
| 896 | return False |
| 897 | |
| 898 | except Exception as e: |
| 899 | logger.error(f"Failed to delete host {mac}: {e}") |
| 900 | return False |
| 901 | |
| 902 | def get_host_by_mac(self, mac: str) -> Optional[Dict]: |
| 903 | """Get host record by MAC address.""" |
| 904 | try: |
| 905 | with self.get_connection() as conn: |
| 906 | cursor = conn.cursor() |
| 907 | cursor.execute("SELECT * FROM hosts WHERE mac = ?", (mac.lower().strip(),)) |
| 908 | row = cursor.fetchone() |
no test coverage detected