From 8ff6341b69262ad7a5b2c7ac681947fdef80801d Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Wed, 21 Feb 2024 11:15:31 +0100 Subject: utils: use returncode from subprocess in ogChangeRepo() ... the exception shows the samba password in the logs specify the error which tells us what has happened according to man mount(8) Return Codes. --- src/utils/legacy.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils/legacy.py b/src/utils/legacy.py index 747a16f..387f790 100644 --- a/src/utils/legacy.py +++ b/src/utils/legacy.py @@ -194,11 +194,10 @@ def ogChangeRepo(ip, smb_user='opengnsys', smb_pass='og'): err = 0 cmd = f'mount.cifs -o {mode},username={smb_user},password={smb_pass} {new_name} /opt/opengnsys/images' - try: - result = subprocess.run(shlex.split(cmd), check=True) - except: + result = subprocess.run(shlex.split(cmd)) + if result.returncode != 0: err = -1 - logging.error(f'Error mounting {new_name} in /opt/opengnsys/images') + logging.error(f'Error mounting {new_name} in /opt/opengnsys/images with error {result.returncode}') cmd = f'mount.cifs -o {mode},username={smb_user},password={smb_pass} {orig_name} /opt/opengnsys/images' subprocess.run(shlex.split(cmd)) -- cgit v1.2.3-18-g5258