From d84a686102a36cd8e6be06ae8058e5a08145b9a7 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Mon, 4 Jul 2022 00:53:39 -0700 Subject: [PATCH] add live root logic before sign off --- iso/empanadas/empanadas/util/dnf_utils.py | 45 +++++++++++++++++++++-- iso/empanadas/empanadas/util/shared.py | 2 + 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/iso/empanadas/empanadas/util/dnf_utils.py b/iso/empanadas/empanadas/util/dnf_utils.py index a40045d..8f74a8b 100644 --- a/iso/empanadas/empanadas/util/dnf_utils.py +++ b/iso/empanadas/empanadas/util/dnf_utils.py @@ -1234,6 +1234,13 @@ class RepoSync: if r in self.iso_map['images']: variants_to_tweak.append(r) + if not len(variants_to_tweak) > 0: + self.log.info( + '[' + Color.BOLD + Color.GREEN + 'INFO' + Color.END + '] ' + + 'No treeinfo to tweak.' + ) + return + for a in arches_to_tree: for v in variants_to_tweak: self.log.info( @@ -1289,10 +1296,9 @@ class RepoSync: def run_compose_closeout(self): """ - Closes out a compose as file. This ensures kickstart repositories are - made, the treeinfo is modifed for the primary repository, syncs - work/isos to compose/isos, and combines all checksum files per arch - into a final CHECKSUM file. + Closes out a compose. This ensures the ISO's are synced from work/isos + to compose/isos, checks for live media and syncs as well from work/live + to compose/live, deploys final metadata. """ # latest-X-Y should exist at all times for this to work. work_root = os.path.join( @@ -1332,6 +1338,11 @@ class RepoSync: "isos" ) + live_root = os.path.join( + work_root, + "live" + ) + global_work_root = os.path.join( work_root, "global", @@ -1366,6 +1377,32 @@ class RepoSync: message ) + if os.path.exists(live_root): + self.log.info( + '[' + Color.BOLD + Color.GREEN + 'INFO' + Color.END + '] ' + + 'Starting to sync live images to compose' + ) + + if os.path.exists('/usr/bin/fpsync'): + message, ret = Shared.fpsync_method(iso_root, sync_iso_root, tmp_dir) + elif os.path.exists('/usr/bin/parallel') and os.path.exists('/usr/bin/rsync'): + message, ret = Shared.rsync_method(iso_root, sync_iso_root) + + if ret != 0: + self.log.error( + '[' + Color.BOLD + Color.RED + 'FAIL' + Color.END + '] ' + + message + ) + else: + self.log.info( + '[' + Color.BOLD + Color.GREEN + 'INFO' + Color.END + '] ' + + message + ) + + # Combine all checksums here + # Deploy final metadata for a close out + self.deploy_metadata(sync_root) + class SigRepoSync: """ This helps us do reposync operations for SIG's. Do not use this for the diff --git a/iso/empanadas/empanadas/util/shared.py b/iso/empanadas/empanadas/util/shared.py index 8993f1d..bd9fe53 100644 --- a/iso/empanadas/empanadas/util/shared.py +++ b/iso/empanadas/empanadas/util/shared.py @@ -505,3 +505,5 @@ class Shared: switches = '-av --chown=10004:10005 --progress --relative --human-readable' os.makedirs(dest, exist_ok=True) + + return 'Not available', 1