From bbcee84ebddae55f172caa84cf991fba536a1e5f Mon Sep 17 00:00:00 2001 From: Vadim Troshchinskiy Date: Tue, 24 Jun 2025 16:30:32 +0200 Subject: [PATCH] Improve error checking --- gitlib/gitlib.py | 5 ++++- interfaceAdm/CrearImagenGit.py | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gitlib/gitlib.py b/gitlib/gitlib.py index 8f5d3f8..4db0d09 100755 --- a/gitlib/gitlib.py +++ b/gitlib/gitlib.py @@ -1244,7 +1244,7 @@ class OpengnsysGitLibrary: if not self.check_remote_exists(repo_name): self.logger.error("Specified repository can't be used, aborting.") - return + return False path = self.fs.ensure_mounted(device) self.logger.info("Initializing repository: %s", path) @@ -1389,6 +1389,7 @@ class OpengnsysGitLibrary: #repo.git.push("--set-upstream", "origin", repo.head.ref, "--force") self.logger.info("initRepo done") + return True def cloneRepo(self, repo_name, destination, boot_device): """ @@ -1497,6 +1498,8 @@ class OpengnsysGitLibrary: Create a tag in the repository """ + self.logger.info("Creating tag %s", tagName) + if path is None: path = self.fs.ensure_mounted(device) diff --git a/interfaceAdm/CrearImagenGit.py b/interfaceAdm/CrearImagenGit.py index d63ce9b..5cc43cf 100755 --- a/interfaceAdm/CrearImagenGit.py +++ b/interfaceAdm/CrearImagenGit.py @@ -51,8 +51,13 @@ def create_image(disk_num, partition_num, repo, image_name, tagName): ntfs_impl = NTFSImplementation.NTFS3G og_git = OpengnsysGitLibrary(ntfs_implementation = ntfs_impl) device = DiskLib.ogDiskToDev(disk_num, partition_num) - og_git.initRepo(device, image_name) - og_git.tag(device = device, tagName = tagName, commit = "HEAD", message = "Image created") + if og_git.initRepo(device, image_name): + return 0 + #if tagName: + # og_git.tag(device = device, tagName = tagName, commit = "HEAD", message = "Image created") + else: + return 1 + def main(): if len(sys.argv) != 6: