Don't always validate distro name
When the output path is not /etc/yum.repos.d, the repo files won't be used to install packages on this host, so there is no need to be strict about host OS name validation. This is useful when building CentOS images from a Fedora workstation. If the host /etc/yum.repos.d is not used, the host distro is not actually relevant. Change-Id: I02b7a2a0d5dc6849fa04e298bce18657a9213621
This commit is contained in:
parent
8c40273219
commit
c5df4a6aca
|
@ -323,6 +323,11 @@ def _validate_distro_stream(args, distro_name, distro_major_version_id):
|
|||
|
||||
Fails if stream is to be used but the host isn't a stream OS or vice versa
|
||||
"""
|
||||
if args.output_path != DEFAULT_OUTPUT_PATH:
|
||||
# don't validate distro name because the output path is not
|
||||
# /etc/yum.repos.d, so the repo files may not be used to install
|
||||
# packages on this host
|
||||
return True
|
||||
if 'centos' not in distro_name.lower():
|
||||
return True
|
||||
if distro_name.lower() == 'centos' and distro_major_version_id != '8':
|
||||
|
|
|
@ -751,11 +751,13 @@ class TestValidate(testtools.TestCase):
|
|||
self.args, '', '')
|
||||
|
||||
def test_invalid_stream(self):
|
||||
self.args.output_path = main.DEFAULT_OUTPUT_PATH
|
||||
self.args.stream = True
|
||||
self.assertRaises(main.InvalidArguments, main._validate_args,
|
||||
self.args, 'CentOS 8', '8')
|
||||
|
||||
def test_invalid_no_stream(self):
|
||||
self.args.output_path = main.DEFAULT_OUTPUT_PATH
|
||||
self.args.stream = False
|
||||
self.args.no_stream = True
|
||||
self.assertRaises(main.InvalidArguments, main._validate_args,
|
||||
|
|
Loading…
Reference in New Issue