Skip to content
Snippets Groups Projects

Remove truncate and add on conflict clause instead

Compare and Show latest version
1 file
+ 5
8
Compare changes
  • Side-by-side
  • Inline
+ 5
8
@@ -232,12 +232,10 @@ def revoke_auth(to_revoke):
@@ -232,12 +232,10 @@ def revoke_auth(to_revoke):
for node_ip in to_revoke:
for node_ip in to_revoke:
cmd = f"sudo nft -a list chain inet filter input | grep '{node_ip}' | awk -F'handle ' '{{print $2}}' | xargs -Ixxx sudo nft delete rule inet filter input handle xxx"
cmd = f"sudo nft -a list chain inet filter input | grep '{node_ip}' | awk -F'handle ' '{{print $2}}' | xargs -Ixxx sudo nft delete rule inet filter input handle xxx"
log.info(f"Running revoke command: {cmd}")
log.info(f"Running revoke command: {cmd}")
p = subprocess.Popen(cmd.split())
p = subprocess.Popen(['/bin/bash', '-c', cmd])
output, error = p.communicate()
p.wait(5)
if output:
if p.returncode != 0:
log.debug(output)
raise OSError(f"Revoke command exited with return code {p.returncode}")
if error:
raise IOError(error)
def id_to_reg_code(cmix_id):
def id_to_reg_code(cmix_id):
@@ -734,10 +732,9 @@ def set_authorizer_nodes(conn, to_add, to_delete):
@@ -734,10 +732,9 @@ def set_authorizer_nodes(conn, to_add, to_delete):
except Exception as e:
except Exception as e:
log.error(f"Failed to insert into authorizer db: {cur.query}")
log.error(f"Failed to insert into authorizer db: {cur.query}")
raise e
raise e
finally:
cur.close()
conn.commit()
conn.commit()
 
cur.close()
return to_revoke
return to_revoke
Loading