summaryrefslogtreecommitdiffstats
path: root/src/utils/legacy.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/legacy.py')
-rw-r--r--src/utils/legacy.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils/legacy.py b/src/utils/legacy.py
index 0f6c53c..a272e4c 100644
--- a/src/utils/legacy.py
+++ b/src/utils/legacy.py
@@ -130,7 +130,7 @@ def ogGetImageInfo(image_path):
return image_info
-def cambiar_acceso(mode='rw', user='opengnsys', pwd='og'):
+def change_access(mode='rw', user='opengnsys', pwd='og'):
"""
'CambiarAcceso' (admin/Interface/CambiarAcceso) rewrite into native Python.
@@ -138,14 +138,14 @@ def cambiar_acceso(mode='rw', user='opengnsys', pwd='og'):
Specify access mode ('rw', or 'ro') with mode parameter (default 'rw').
Specify samba credentials with user and pwd parameter.
- Return True if exit-code was 0. Return False otherwise.
+ Return 0 if exit-code was 0. Return -1 otherwise.
"""
- if mode not in ['rw', 'ro']:
- raise ValueError('Invalid remount mode option')
+ assert mode in ['rw', 'ro'], 'Invalid remount mode option'
cmd = shlex.split(f'mount -o remount,{mode},username={user},password={pwd} /opt/opengnsys/images')
p = subprocess.run(cmd, stdout=DEVNULL, stderr=DEVNULL)
- return p.returncode == 0
+
+ return 0 if p.returncode == 0 else -1
def ogChangeRepo(ip, smb_user='opengnsys', smb_pass='og'):
"""