aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
Diffstat (limited to 'kolla')
-rwxr-xr-xkolla/common/config.py4
-rwxr-xr-xkolla/image/build.py15
-rw-r--r--kolla/tests/test_build.py40
3 files changed, 38 insertions, 21 deletions
diff --git a/kolla/common/config.py b/kolla/common/config.py
index 5d1082f65..05ccb13e0 100755
--- a/kolla/common/config.py
+++ b/kolla/common/config.py
@@ -266,10 +266,6 @@ _BASE_OPTS = [
cfg.StrOpt('maintainer',
default='Kolla Project (https://launchpad.net/kolla)',
help='Content of the maintainer label'),
- cfg.BoolOpt('distro_python3', default=None,
- help=('Enable this to force python3 packaging names. By '
- 'default this will try and determine the value of this '
- 'based on the base_distro and base_distro_tag.')),
cfg.StrOpt('base_package_type', default=None,
help=('Set the package type of the distro. If not set then '
'the packaging type is set to "rpm" if a RHEL based '
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 0306d9b2b..624db3406 100755
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -693,13 +693,13 @@ class KollaWorker(object):
deb_base = ['ubuntu', 'debian']
deb_type = ['source', 'binary']
- if self.conf.distro_python3 is not None:
- self.distro_python3 = self.conf.distro_python3
- elif self.base in rh_base and self.base_tag in ['8']:
- # RHEL 8+ is python3
- self.distro_python3 = True
+ if self.base in rh_base and self.base_tag.startswith('7'):
+ self.conf.distro_python_version = "2.7"
+ elif self.base in rh_base and self.base_tag.startswith('8'):
+ self.conf.distro_python_version = "3.6"
else:
- self.distro_python3 = False
+ # Assume worst
+ self.conf.distro_python_version = "2.7"
# Determine base packaging type for use in Dockerfiles.
if self.conf.base_package_type:
@@ -738,6 +738,7 @@ class KollaWorker(object):
self.image_statuses_unmatched = dict()
self.image_statuses_skipped = dict()
self.maintainer = conf.maintainer
+ self.distro_python_version = conf.distro_python_version
docker_kwargs = docker.utils.kwargs_from_env()
try:
@@ -915,7 +916,7 @@ class KollaWorker(object):
'kolla_version': kolla_version,
'image_name': image_name,
'users': self.get_users(),
- 'distro_python3': self.distro_python3,
+ 'distro_python_version': self.distro_python_version,
'rpm_setup': self.rpm_setup,
'build_date': build_date}
env = jinja2.Environment( # nosec: not used to render HTML
diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py
index 6ed50fbf1..32c5a9928 100644
--- a/kolla/tests/test_build.py
+++ b/kolla/tests/test_build.py
@@ -381,25 +381,45 @@ class KollaWorkerTest(base.TestCase):
kolla = build.KollaWorker(self.conf)
self.assertEqual(2, len(kolla.rpm_setup))
- def test_build_distro_python3(self):
- """check distro_python3 conf value is taken"""
- self.conf.set_override('distro_python3', True)
+ def test_build_distro_python_version_debian(self):
+ """check distro_python_version for Debian"""
+ self.conf.set_override('base', 'debian')
+ kolla = build.KollaWorker(self.conf)
+ self.assertEqual('2.7', kolla.distro_python_version)
+
+ def test_build_distro_python_version_rhel80(self):
+ """check distro_python_version for RHEL8.0"""
+ self.conf.set_override('base', 'rhel')
+ self.conf.set_override('base_tag', '8.0')
kolla = build.KollaWorker(self.conf)
- self.assertTrue(kolla.distro_python3)
+ self.assertEqual('3.6', kolla.distro_python_version)
- def test_build_distro_python3_rhel8(self):
- """check distro_python3 true for rhel8"""
+ def test_build_distro_python_version_rhel8(self):
+ """check distro_python_version for RHEL8"""
self.conf.set_override('base', 'rhel')
self.conf.set_override('base_tag', '8')
kolla = build.KollaWorker(self.conf)
- self.assertTrue(kolla.distro_python3)
+ self.assertEqual('3.6', kolla.distro_python_version)
+
+ def test_build_distro_python_version_ubuntu(self):
+ """check distro_python_version for Ubuntu"""
+ self.conf.set_override('base', 'ubuntu')
+ kolla = build.KollaWorker(self.conf)
+ self.assertEqual('2.7', kolla.distro_python_version)
+
+ def test_build_distro_python_version_centos7(self):
+ """check distro_python_version for CentOS 7.6.1810"""
+ self.conf.set_override('base', 'centos')
+ self.conf.set_override('base_tag', '7.6.1810')
+ kolla = build.KollaWorker(self.conf)
+ self.assertEqual('2.7', kolla.distro_python_version)
- def test_build_distro_python3_non_rhel8(self):
- """check distro_python3 false for non-rhel8"""
+ def test_build_distro_python_version_rhel7(self):
+ """check distro_python_version for RHEL7"""
self.conf.set_override('base', 'rhel')
self.conf.set_override('base_tag', '7')
kolla = build.KollaWorker(self.conf)
- self.assertFalse(kolla.distro_python3)
+ self.assertEqual('2.7', kolla.distro_python_version)
def test_base_package_type(self):
"""check base_package_type conf value is taken"""