Skip to content

Commit

Permalink
Fix: Users reported errors with key family absent from entry
Browse files Browse the repository at this point in the history
On Debian 11:

```
python3[1910876]:     if not check_if_table_exists("ip", table):
python3[1910876]:   File "/opt/aleph-vm/vm_supervisor/network/firewall.py", line 91, in check_if_table_exists
python3[1910876]:     and entry["family"] == family
python3[1910876]: KeyError: 'family'
```
  • Loading branch information
hoh committed Jun 28, 2023
1 parent 8c0154e commit 8777a0a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vm_supervisor/network/firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ def check_if_table_exists(family: str, table: str) -> bool:
if (
isinstance(entry, dict)
and "table" in entry
and entry["family"] == family
and entry["name"] == table
# Key "family" was reported by users as not always present, so we use .get() instead of [].
and entry.get("family") == family
and entry.get("name") == table
):
return True
return False
Expand Down

0 comments on commit 8777a0a

Please sign in to comment.