From 60fe306890a08a8fb128145d83de3a342e9cf77b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 15 Mar 2024 13:03:46 -0400 Subject: [PATCH] Numerous fixes Normalize cloning by wipefs prior to image2disk Have imgutil filter out zram mounts. Fix syncfiles error handling. --- .../el9-diskless/profiles/default/scripts/installimage | 1 + confluent_server/confluent/syncfiles.py | 5 +++-- imgutil/imgutil | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage b/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage index 2e791ce6..56597086 100644 --- a/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage +++ b/confluent_osdeploy/el9-diskless/profiles/default/scripts/installimage @@ -30,6 +30,7 @@ if [ ! -f /sysroot/tmp/installdisk ]; then done fi lvm vgchange -a n +/sysroot/usr/sbin/wipefs -a /dev/$(cat /sysroot/tmp/installdisk) udevadm control -e if [ -f /sysroot/etc/lvm/devices/system.devices ]; then rm /sysroot/etc/lvm/devices/system.devices diff --git a/confluent_server/confluent/syncfiles.py b/confluent_server/confluent/syncfiles.py index 6c11d072..70e5bdaf 100644 --- a/confluent_server/confluent/syncfiles.py +++ b/confluent_server/confluent/syncfiles.py @@ -193,6 +193,7 @@ def sync_list_to_node(sl, node, suffixes, peerip=None): targip = node if peerip: targip = peerip + #BOOO, need stderr!!! output = util.run( ['rsync', '-rvLD', targdir + '/', 'root@[{}]:/'.format(targip)])[0] except Exception as e: @@ -212,7 +213,7 @@ def sync_list_to_node(sl, node, suffixes, peerip=None): unreadablefiles.append(filename.replace(targdir, '')) if unreadablefiles: raise Exception("Syncing failed due to unreadable files: " + ','.join(unreadablefiles)) - elif b'Permission denied, please try again.' in e.stderr: + elif hasattr(e, 'stderr') and e.stderr and b'Permission denied, please try again.' in e.stderr: raise Exception('Syncing failed due to authentication error, is the confluent automation key not set up (osdeploy initialize -a) or is there some process replacing authorized_keys on the host?') else: raise @@ -231,7 +232,7 @@ def stage_ent(currmap, ent, targdir, appendexist=False): everyfent = [] allfents = ent.split() for tmpent in allfents: - fents = glob.glob(tmpent) + fents = glob.glob(tmpent) # TODO: recursive globbing? if not fents: raise Exception('No matching files for "{}"'.format(tmpent)) everyfent.extend(fents) diff --git a/imgutil/imgutil b/imgutil/imgutil index 959c4a17..022279cc 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -83,6 +83,8 @@ def get_partition_info(): dev, mount, fs, flags = entry.split()[:4] if mount not in capmounts: continue + if '/dev/zram' in dev: + continue fsinfo = os.statvfs(mount) partinfo = { 'mount': mount,