summaryrefslogtreecommitdiff
path: root/autopeer_shell.py
diff options
context:
space:
mode:
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: