diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-14 22:10:30 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-15 16:22:23 +0100 |
commit | 0fc7f8f33eecad34976ae14617c736bf78eb3b0e (patch) | |
tree | 530182039c0047c0626affaf2b909288758d8954 /src/live | |
parent | 44250d033462666b9983c8d9b8e1c6cda5236ceb (diff) |
src: ogChangeRepo returns zero on success and -1 on error
do not return the returncode, instead return an integer.
do not use
except CalledProcessError as e:
it causes a another exception while handling exception.
Remount the original image repository.
it should be possible to simplify this further by:
- stacking mounts, no need to umount initial repo and mount it again
when switching to the new repo, because remount back initial repo
might fail (!)
- use check=False and simply check for x.returncode
Diffstat (limited to 'src/live')
-rw-r--r-- | src/live/ogOperations.py | 4 |
1 files changed, 2 insertions, 2 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}') |