diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/live/ogOperations.py | 4 | ||||
-rw-r--r-- | src/utils/legacy.py | 17 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 05e6c8e..0a75630 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -142,7 +142,7 @@ class OgLiveOperations: raise ValueError(f'Error: Cannot copy image {image_name} to cache') def _restore_image_unicast(self, repo, name, devpath, cache=False): - if ogChangeRepo(repo, smb_user=self._smb_user, smb_pass=self._smb_pass).returncode != 0: + if ogChangeRepo(repo, smb_user=self._smb_user, smb_pass=self._smb_pass) != 0: self._restartBrowser(self._url) logging.error('ogChangeRepo could not change repository to %s', repo) raise ValueError(f'Error: Cannot change repository to {repo}') @@ -418,7 +418,7 @@ class OgLiveOperations: self._ogbrowser_clear_logs() self._restartBrowser(self._url_log) - if ogChangeRepo(repo, smb_user=self._smb_user, smb_pass=self._smb_pass).returncode != 0: + if ogChangeRepo(repo, smb_user=self._smb_user, smb_pass=self._smb_pass) != 0: self._restartBrowser(self._url) logging.error('ogChangeRepo could not change repository to %s', repo) raise ValueError(f'Error: Cannot change repository to {repo}') diff --git a/src/utils/legacy.py b/src/utils/legacy.py index a272e4c..437dbfd 100644 --- a/src/utils/legacy.py +++ b/src/utils/legacy.py @@ -192,15 +192,18 @@ def ogChangeRepo(ip, smb_user='opengnsys', smb_pass='og'): else: umount(mntdir) + 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 CalledProcessError as e: - logging.error(f'Error mounting new image directory: {e}') - cmd = f'mount.cifs -o {mode},username={smb_user},password={smb_pass} {orig_name} /opt/opengnsys/images' - result = subprocess.run(shlex.split(cmd), check=True) - finally: - return result + except: + err = -1 + logging.error(f'Error mounting {new_name} in /opt/opengnsys/images') + + cmd = f'mount.cifs -o {mode},username={smb_user},password={smb_pass} {orig_name} /opt/opengnsys/images' + subprocess.run(shlex.split(cmd)) + + return err def restoreImageCustom(repo_ip, image_name, disk, partition, method): @@ -210,7 +213,7 @@ def restoreImageCustom(repo_ip, image_name, disk, partition, method): logging.error('Invalid restoreImageCustom invocation') raise ValueError('Error: restoreImageCustom not found') - if ogChangeRepo(repo).returncode != 0: + if ogChangeRepo(repo) != 0: logging.error('ogChangeRepo could not change repository to %s', repo) raise ValueError(f'Error: Cannot change repository to {repo}') |