Skip to content

Commit 897a38c

Browse files
committed
fix supervisor-filter rule recreating
1 parent 1a7788a commit 897a38c

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

src/aleph/vm/network/firewall.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,19 @@ def is_entity_present(nft_ruleset: list[dict], t: EntityType, **kwargs) -> bool:
113113

114114

115115
def _is_superset(a, b):
116-
for k, v in a.items():
117-
if b.get(k) != v:
116+
if isinstance(a, dict) and isinstance(b, dict):
117+
for k, v in a.items():
118+
if k not in b:
119+
return False
120+
if not _is_superset(v, b[k]):
121+
return False
122+
return True
123+
elif isinstance(a, list) and isinstance(b, list):
124+
if len(a) != len(b):
118125
return False
119-
return True
126+
return all(_is_superset(x, y) for x, y in zip(a, b))
127+
else:
128+
return a == b
120129

121130

122131
<<<<<<< HEAD
@@ -287,7 +296,7 @@ def initialize_nftables() -> None:
287296
"match": {
288297
"op": "in",
289298
"left": {"ct": {"key": "state"}},
290-
"right": ["related", "established"],
299+
"right": ["established", "related"],
291300
}
292301
},
293302
{"accept": None},

0 commit comments

Comments
 (0)