summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils/legacy.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/utils/legacy.py b/src/utils/legacy.py
index aca8abe..96b32eb 100644
--- a/src/utils/legacy.py
+++ b/src/utils/legacy.py
@@ -5,7 +5,7 @@ import subprocess
import shlex
import shutil
-from subprocess import PIPE
+from subprocess import PIPE, DEVNULL
def ogGetImageInfo(path):
"""
@@ -29,20 +29,20 @@ def ogGetImageInfo(path):
def cambiar_acceso(mode='rw', user='opengnsys', pwd='og'):
"""
- 'CambiarAcceso' wrapper (admin/Interface/CambiarAcceso)
+ 'CambiarAcceso' (admin/Interface/CambiarAcceso) rewrite into native Python.
+
+ Remount the (remote) samba directory that contains the OpenGnsys images.
+ 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.
"""
if mode not in ['rw', 'ro']:
raise ValueError('Invalid remount mode option')
cmd = shlex.split(f'mount -o remount,{mode},username={user},password={pwd} /opt/opengnsys/images')
- ret = True
- try:
- subprocess.run(cmd, check=True)
- except CalledProcessError:
- ret = False
- finally:
- return ret
-
+ p = subprocess.run(cmd, stdout=DEVNULL, stderr=DEVNULL)
+ return p.returncode == 0
def ogChangeRepo(ip):
"""