Skip to content

Commit

Permalink
Remove sudo requirement for exit-node --status
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoenzo committed Sep 29, 2024
1 parent d2c2469 commit b09d5b7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions wirescale/wirescale.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,17 @@ def main():
elif ARGS.UPGRADE:
UnixClient.upgrade()
elif ARGS.EXIT_NODE:
check_root(message="Error: The 'exit-node' option requires sudo privileges.")
with ExitNode.locker():
if ARGS.STATUS:
ExitNode.status()
elif ARGS.STOP:
ExitNode.remove_exit_node()
elif ARGS.SYNC:
ExitNode.sync()
else:
ExitNode.set_exit_node(ARGS.INTERFACE)
if ARGS.STATUS:
ExitNode.status()
else:
check_root(message="Error: The 'exit-node' option requires sudo privileges.")
with ExitNode.locker():
if ARGS.STOP:
ExitNode.remove_exit_node()
elif ARGS.SYNC:
ExitNode.sync()
else:
ExitNode.set_exit_node(ARGS.INTERFACE)
elif ARGS.RECOVER:
main_pid = subprocess.run(['systemctl', 'show', '-p', 'MainPID', f'autoremove-{ARGS.INTERFACE}.service'], capture_output=True, text=True).stdout.strip()
main_pid = int(main_pid.replace('MainPID=', ''))
Expand Down

0 comments on commit b09d5b7

Please sign in to comment.