summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-02-21 11:15:31 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-02-21 11:16:19 +0100
commit8ff6341b69262ad7a5b2c7ac681947fdef80801d (patch)
treeea42ed4474c662e59329c20583989286af3d3c1e
parent92ef3d68aa496e9fe7619077426b8902e4eefe6a (diff)
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.
-rw-r--r--src/utils/legacy.py7
1 files 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))