From de5b454ed6ae4b2f138d43da6bf1cdbaee01aec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian-Samuel=20Geb=C3=BChr?= Date: Wed, 11 Jan 2023 20:13:27 +0100 Subject: [PATCH] Add deletion for deploy --- models.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index 3c8ad4d..ee0ef31 100644 --- a/models.py +++ b/models.py @@ -1,3 +1,5 @@ +import logging + import requests @@ -108,11 +110,17 @@ class Instance: def apply_blocks_from_diff(diffs, server, token): for diff in diffs: if diff["local"] is None: - pass + """Delete the block on the remote server""" + diff['remote'].delete(server, token) + logging.info(f"Deleted {diff['remote'].domain} from blocklist") elif diff["remote"] is None: + """Add the block on the remote server""" diff["local"].apply(server, token) + logging.info(f"Added {diff['remote'].domain} to blocklist") else: + """Update the block on the remote server""" diff["local"].apply(server, token, block_id=diff["remote"].id) + logging.info(f"Updated {diff['remote'].domain} in blocklist") @staticmethod def show_diffs(local_blocklist, remote_blocklist):