Fix stream arg validation

Now that args.stream is always true, the validation must take into
account whether args.no_stream is set. Without this validation will
always fail on non-stream distros.

Change-Id: I2d1f2f6d72e8ebbec69885faf825f0aee8afbbfc
This commit is contained in:
Steve Baker 2021-04-20 10:59:11 +12:00
parent e91bd735f7
commit f25e26cba0
1 changed files with 3 additions and 2 deletions

View File

@ -295,10 +295,11 @@ def _validate_distro_stream(args, distro_name):
Fails if stream is to be used but the host isn't a stream OS or vice versa
"""
if args.stream and 'stream' not in distro_name.lower():
is_stream = args.stream and not args.no_stream
if is_stream and 'stream' not in distro_name.lower():
raise InvalidArguments('--stream provided, but OS is not the Stream '
'version. Please ensure the host is Stream.')
elif args.no_stream and 'stream' in distro_name.lower():
elif not is_stream and 'stream' in distro_name.lower():
raise InvalidArguments('--no-stream provided, but OS is the Stream '
'version. Please ensure the host is not the '
'Stream version.')