2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 03:19:48 +00:00

Improve appearance of imgutil capture

Provide more feedback with less worrisome normal output.
This commit is contained in:
Jarrod Johnson 2021-07-27 08:36:48 -04:00
parent 4c96735b6d
commit af9676ee6f

View File

@ -161,23 +161,23 @@ def capture_remote(opts, args):
if finfo['oscategory'] != 'el8':
raise Exception('Not yet supported for capture: ' + repr(finfo))
oscat = finfo['oscategory']
subprocess.check_call(['ssh', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocal'])
subprocess.check_call(['ssh', '-o', 'LogLevel=QUIET', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocal'])
utillib = __file__.replace('bin/imgutil', 'lib/imgutil')
utillib = os.path.join(utillib, '{}/dracut/'.format(oscat))
subprocess.check_call(['rsync', '-a', utillib, '{0}:/usr/lib/dracut/modules.d/97confluent'.format(targ)])
subprocess.check_call(['ssh', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocalboot'])
sys.stdout.write('Transferring image...')
sys.stdout.write('Generating deployment initramfs...')
sys.stdout.flush()
subprocess.check_call(['rsync', '-a', '{0}:/run/imgutil/capout/'.format(targ), outdir])
subprocess.check_call(['ssh', '-o', 'LogLevel=QUIET', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocalboot'])
print('Done\nTransferring image...')
sys.stdout.flush()
subprocess.check_call(['rsync', '-a', '--info=progress2', '{0}:/run/imgutil/capout/'.format(targ), outdir])
oum = os.umask(0o077)
mkdirp(os.path.join(privdir, 'pending'))
subprocess.check_call(['rsync', '-a', '{0}:/run/imgutil/private.key'.format(targ), '{}/pending/rootimg.key'.format(privdir)])
os.umask(oum)
subprocess.check_call(['chown', '-R', 'confluent', privdir])
subprocess.check_call(['chmod', 'og-rwx', '-R', privdir])
sys.stdout.write('Done\n')
sys.stdout.flush()
subprocess.check_call(['ssh', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocalcleanup'])
subprocess.check_call(['ssh', '-o', 'LogLevel=QUIET', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocalcleanup'])
profname = os.path.basename(outdir)
os.symlink('/var/lib/confluent/public/site/initramfs.cpio',
os.path.join(outdir, 'boot/initramfs/site.cpio'))
@ -192,6 +192,8 @@ def capture_remote(opts, args):
profileout.write('kernelargs: quiet installtodisk # remove installtodisk to boot stateless')
subprocess.check_call(['chmod', 'o+r,go-w,a-t', '-R', outdir])
subprocess.check_call(['chown', '-R', 'confluent', outdir])
sys.stdout.write('Updating boot image... ')
sys.stdout.flush()
subprocess.check_call(['osdeploy', 'updateboot', profname])