From b09d5b710eab89910c50e4dab261ab2786199c99 Mon Sep 17 00:00:00 2001 From: Fernando Guarini Date: Sun, 29 Sep 2024 18:06:07 +0200 Subject: [PATCH] Remove `sudo` requirement for `exit-node --status` --- wirescale/wirescale.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/wirescale/wirescale.py b/wirescale/wirescale.py index deae866..cf3e809 100644 --- a/wirescale/wirescale.py +++ b/wirescale/wirescale.py @@ -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=', ''))