fix no hostname
This commit is contained in:
parent
26bda6277c
commit
c8b3a8d98b
2 changed files with 4 additions and 3 deletions
|
@ -109,7 +109,7 @@ def run_forever(address: str, period: int, ssid: str, output: str):
|
|||
|
||||
if len(registered_leases) > 0:
|
||||
if len([lease for lease in registered_leases
|
||||
if not any(re.match(ch, lease.hostname) for ch in config.computer_hostnames)]) > 0:
|
||||
if not any(re.match(ch, lease.hostname or "") for ch in config.computer_hostnames)]) > 0:
|
||||
status = Status(status="populated", text="There seem to be people!")
|
||||
else:
|
||||
status = Status(status="empty", text="There are only computers.")
|
||||
|
@ -139,7 +139,8 @@ def run_forever(address: str, period: int, ssid: str, output: str):
|
|||
writer.writerow((lease.ip, lease.mac, lease.hostname or "???"))
|
||||
elif output_file.endswith(".html"):
|
||||
last_human = next((lease for lease in _fetch_leases(db, now - timedelta(hours=24))
|
||||
if not any(re.match(ch, lease.hostname) for ch in config.computer_hostnames)), None)
|
||||
if not any(re.match(ch, lease.hostname or "") for ch in config.computer_hostnames)),
|
||||
None)
|
||||
|
||||
logging.debug(f"Outputting HTML file into {output_file}...")
|
||||
with open(output_file, 'w') as file:
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
{% for lease in leases %}
|
||||
<tr>
|
||||
<td>{{lease.mac}}</td>
|
||||
<td>{{lease.hostname}}</td>
|
||||
<td>{{lease.hostname or "???"}}</td>
|
||||
<td>{{lease.ip}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue