Improve error checking

ogrepository-fixes
Vadim vtroshchinskiy 2025-06-24 16:30:32 +02:00
parent 6a904ee7eb
commit bbcee84ebd
2 changed files with 11 additions and 3 deletions

View File

@ -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)

View File

@ -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: