aboutsummaryrefslogtreecommitdiff
path: root/autopeer_shell.py
diff options
context:
space:
mode:
authorGravatar steering72532026-04-10 15:55:34 +0000
committerGravatar steering72532026-04-10 15:55:34 +0000
commit548bafebf16cb5a5a392d7bfa1d08e6cc2e5923e (patch)
tree6fa430132f951de4832d494c101a5e179d344555 /autopeer_shell.py
parentadd notifications (diff)
properly support deleting
Diffstat (limited to 'autopeer_shell.py')
-rwxr-xr-xautopeer_shell.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/autopeer_shell.py b/autopeer_shell.py
index 2c6eac4..1e13b71 100755
--- a/autopeer_shell.py
+++ b/autopeer_shell.py
@@ -118,7 +118,7 @@ class AutopeerShell(cmd.Cmd):
try:
curs = DB.execute(
- 'INSERT INTO peers (name, asn, pubkey, endpoint, port, ipll, creator_ip, creator_name, creator_date) VALUES (:name, :asn, :pubkey, :endpoint, :port, :ipll, :creator_ip, :creator_name, :creator_date)',
+ 'INSERT INTO peers (name, asn, pubkey, endpoint, port, ipll, creator_ip, creator_name, creator_date, deleted) VALUES (:name, :asn, :pubkey, :endpoint, :port, :ipll, :creator_ip, :creator_name, :creator_date, 0)',
dict(name=name, asn=SELECTED_ASN, pubkey=pubkey, endpoint=endpoint, port=port, ipll=ipll, creator_ip=os.getenv('SSH_CONNECTION'), creator_name=USER, creator_date=time.time())
)
except sqlite3.IntegrityError as e:
@@ -141,7 +141,7 @@ class AutopeerShell(cmd.Cmd):
Delete your peering'''
sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.gethostname()}] Deleted peering {name!r} for AS{SELECTED_ASN} by {USER}", text=True)
curs = DB.execute(
- 'DELETE FROM peers WHERE name = :name AND asn = :asn',
+ 'UPDATE peers SET deleted = 1 WHERE name = :name AND asn = :asn AND deleted = 0',
dict(name=name, asn=SELECTED_ASN)
)
if curs.rowcount: