Add support for CentOS 8 amphora images

Change-Id: Ic3b1dab418cfd95fe261ca19528ec969ee57610e
This commit is contained in:
Carlos Goncalves 2019-12-03 17:12:22 +01:00
parent d115644d3e
commit 3740b67854
7 changed files with 45 additions and 10 deletions

View File

@ -8,6 +8,15 @@
"screen": "", "screen": "",
"dkms": "" "dkms": ""
} }
},
"centos": {
"8": {
"isc-dhcp-client": "dhcp-client",
"python-dev": "platform-python-devel",
"vlan": "",
"screen": "",
"dkms": ""
}
} }
}, },
"family": { "family": {

View File

@ -7,6 +7,6 @@ fi
set -eu set -eu
set -o pipefail set -o pipefail
if [ "$DISTRO_NAME" == "rhel" ] && [ "$DIB_RELEASE" == "8" ]; then if [[ "$DISTRO_NAME" =~ (rhel|centos) ]] && [ "$DIB_RELEASE" == "8" ]; then
chkconfig network on chkconfig network on
fi fi

View File

@ -41,10 +41,9 @@ j2_env = jinja2.Environment(autoescape=True, loader=jinja2.FileSystemLoader(
class BaseOS(object): class BaseOS(object):
PACKAGE_NAME_MAP = {}
def __init__(self, os_name): def __init__(self, os_name):
self.os_name = os_name self.os_name = os_name
self.package_name_map = {}
@classmethod @classmethod
def _get_subclasses(cls): def _get_subclasses(cls):
@ -61,9 +60,8 @@ class BaseOS(object):
return subclass(os_name) return subclass(os_name)
raise octavia_exceptions.InvalidAmphoraOperatingSystem(os_name=os_name) raise octavia_exceptions.InvalidAmphoraOperatingSystem(os_name=os_name)
@classmethod def _map_package_name(self, package_name):
def _map_package_name(cls, package_name): return self.package_name_map.get(package_name, package_name)
return cls.PACKAGE_NAME_MAP.get(package_name, package_name)
def get_network_interface_file(self, interface): def get_network_interface_file(self, interface):
if CONF.amphora_agent.agent_server_network_file: if CONF.amphora_agent.agent_server_network_file:
@ -558,7 +556,10 @@ class RH(BaseOS):
class CentOS(RH): class CentOS(RH):
PACKAGE_NAME_MAP = {'haproxy': 'haproxy18'} def __init__(self, os_name):
super(CentOS, self).__init__(os_name)
if distro.version() == '7':
self.package_name_map.update({'haproxy': 'haproxy18'})
@classmethod @classmethod
def is_os_name(cls, os_name): def is_os_name(cls, os_name):

View File

@ -43,10 +43,13 @@ class TestOSUtils(base.TestCase):
return_value='rhel'): return_value='rhel'):
self.rh_os_util = osutils.BaseOS.get_os_util() self.rh_os_util = osutils.BaseOS.get_os_util()
with mock.patch('distro.id', with mock.patch('distro.id', return_value='centos'):
return_value='centos'):
self.centos_os_util = osutils.BaseOS.get_os_util() self.centos_os_util = osutils.BaseOS.get_os_util()
with mock.patch('distro.id', return_value='centos'):
with mock.patch('distro.version', return_value='7'):
self.centos7_os_util = osutils.BaseOS.get_os_util()
def test_get_os_util(self): def test_get_os_util(self):
with mock.patch('distro.id', with mock.patch('distro.id',
return_value='ubuntu'): return_value='ubuntu'):
@ -178,8 +181,14 @@ class TestOSUtils(base.TestCase):
def test_cmd_get_version_of_installed_package_mapped(self): def test_cmd_get_version_of_installed_package_mapped(self):
package_name = 'haproxy' package_name = 'haproxy'
centos_cmd = "rpm -q --queryformat %{VERSION} haproxy18" centos7_cmd = "rpm -q --queryformat %{VERSION} haproxy18"
returned_centos7_cmd = (
self.centos7_os_util.cmd_get_version_of_installed_package(
package_name))
self.assertEqual(centos7_cmd, returned_centos7_cmd)
centos_cmd = "rpm -q --queryformat %{VERSION} haproxy"
returned_centos_cmd = ( returned_centos_cmd = (
self.centos_os_util.cmd_get_version_of_installed_package( self.centos_os_util.cmd_get_version_of_installed_package(
package_name)) package_name))

View File

@ -0,0 +1,4 @@
---
features:
- |
Added support for CentOS 8 amphora images.

View File

@ -60,6 +60,16 @@
amphora_image_size: 3 amphora_image_size: 3
amphora_os_release: 7 amphora_os_release: 7
- job:
name: publish-openstack-octavia-amphora-image-centos8
parent: publish-openstack-octavia-amphora-image
description: |
Publish CentOS 8 based amphora image to tarballs.o.o.
vars:
amphora_os: centos
amphora_image_size: 3
amphora_os_release: 8
- job: - job:
name: octavia-grenade name: octavia-grenade
parent: octavia-legacy-dsvm-base parent: octavia-legacy-dsvm-base

View File

@ -75,3 +75,5 @@
branches: ^(?!stable/.*).*$ branches: ^(?!stable/.*).*$
- publish-openstack-octavia-amphora-image-centos7: - publish-openstack-octavia-amphora-image-centos7:
branches: ^(?!stable/.*).*$ branches: ^(?!stable/.*).*$
- publish-openstack-octavia-amphora-image-centos8:
branches: ^(?!stable/.*).*$