Add deletion for deploy
This commit is contained in:
parent
ddc7fb5936
commit
de5b454ed6
10
models.py
10
models.py
@ -1,3 +1,5 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
@ -108,11 +110,17 @@ class Instance:
|
|||||||
def apply_blocks_from_diff(diffs, server, token):
|
def apply_blocks_from_diff(diffs, server, token):
|
||||||
for diff in diffs:
|
for diff in diffs:
|
||||||
if diff["local"] is None:
|
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:
|
elif diff["remote"] is None:
|
||||||
|
"""Add the block on the remote server"""
|
||||||
diff["local"].apply(server, token)
|
diff["local"].apply(server, token)
|
||||||
|
logging.info(f"Added {diff['remote'].domain} to blocklist")
|
||||||
else:
|
else:
|
||||||
|
"""Update the block on the remote server"""
|
||||||
diff["local"].apply(server, token, block_id=diff["remote"].id)
|
diff["local"].apply(server, token, block_id=diff["remote"].id)
|
||||||
|
logging.info(f"Updated {diff['remote'].domain} in blocklist")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def show_diffs(local_blocklist, remote_blocklist):
|
def show_diffs(local_blocklist, remote_blocklist):
|
||||||
|
Loading…
Reference in New Issue
Block a user