From e93e4abd837d716d0fdc54d71da6f3fe27cf4790 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 10 May 2023 08:40:45 -0400 Subject: [PATCH] Add clear error when base profile doesn't exist If the user specifies a wrong '-b', indicate clearly that is the case, and do so early. --- imgutil/imgutil | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/imgutil/imgutil b/imgutil/imgutil index a4bbb3d0..57e5539b 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -1206,7 +1206,14 @@ def recursecp(source, targ): def pack_image(args): outdir = args.profilename if '/' in outdir: - raise Exception('Full path not supported, supply only the profile name') + raise Exception('Full path not supported, supply only the profile name\n') + if args.baseprofile: + baseprofiledir = args.baseprofile + if '/' not in args.baseprofile: + baseprofiledir = os.path.join('/var/lib/confluent/public/os', args.baseprofile) + if not os.path.exists(baseprofiledir): + sys.stderr.write('Specified base profile "{0}" does not seem to exist\n'.format(baseprofiledir)) + sys.exit(1) privdir = os.path.join('/var/lib/confluent/private/os/', outdir) outdir = os.path.join('/var/lib/confluent/public/os/', outdir) if os.path.exists(outdir):