Add support for EL9 and python3.9

Following is done:-
- Using distro module to get distribution as platform
  module no longer provide that with python3.8+[1].
- Use mariadb-server-galera as mariadb don't provide
  mariadb-galera-server in EL9[2].
- Ensure 'cronie' package is installed before attempting
  start of crond service.

[1] https://bugs.python.org/issue28167
[2] https://src.fedoraproject.org/rpms/mariadb/c/b1bc71c1a

Change-Id: I744de28a25739c00f585b7d9c12627ce0ed902f2
(cherry picked from commit e11f86aeca)
This commit is contained in:
yatinkarel 2021-05-20 18:09:36 +05:30 committed by Joel Capitao
parent f6ed301eba
commit 44df9d617e
7 changed files with 24 additions and 13 deletions

View File

@ -16,8 +16,8 @@
Installs and configures Nova
"""
import distro
import os
import platform
import socket
from packstack.installer import basedefs
@ -38,7 +38,7 @@ PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controller):
if platform.linux_distribution()[0] == "Fedora":
if distro.linux_distribution()[0] == "Fedora":
primary_netif = "em1"
secondary_netif = "em2"
else:

View File

@ -16,10 +16,10 @@
Plugin responsible for setting OpenStack global options
"""
import distro
import os
import re
import logging
import platform
import glob
import os
import uuid
@ -949,16 +949,16 @@ def initSequences(controller):
def is_rhel():
return 'Red Hat Enterprise Linux' in platform.linux_distribution()[0]
return 'Red Hat Enterprise Linux' in distro.linux_distribution()[0]
def detect_os_and_version(host):
server = utils.ScriptRunner(host)
server.append(
'python -c "import platform; '
'print platform.linux_distribution(full_distribution_name=0)[0]'
'python -c "import distro; '
'print distro.linux_distribution(full_distribution_name=0)[0]'
'+\',\'+'
'platform.linux_distribution()[1]"'
'distro.linux_distribution()[1]"'
)
try:
rc, out = server.execute()

View File

@ -4,9 +4,9 @@
Facter.add(:mariadb_provides_galera) do
setcode do
if Facter.value(:operatingsystem) == 'Fedora' and Facter.value(:operatingsystemmajrelease).to_i > 22
command = 'dnf repoquery --whatprovides mariadb-galera-server'
command = 'dnf repoquery --whatprovides mariadb-server-galera'
else
command = 'repoquery --whatprovides mariadb-galera-server'
command = 'repoquery --whatprovides mariadb-server-galera'
end
output = Facter::Util::Resolution.exec(command)
(output =~ /mariadb-server-galera.*/) != nil

View File

@ -15,9 +15,14 @@ class packstack::keystone ()
class { '::keystone::cron::fernet_rotate':
require => Service['crond'],
}
package { 'cronie':
ensure => 'installed',
name => 'cronie',
}
service { 'crond':
ensure => 'running',
enable => true,
ensure => 'running',
enable => true,
require => Package['cronie'],
}
}

View File

@ -9,8 +9,8 @@ class packstack::mariadb ()
$mariadb_package_name = 'mariadb-server-galera'
$mariadb_present = 'present'
} else {
# Package mariadb-server conflicts with mariadb-galera-server
$mariadb_package_name = 'mariadb-galera-server'
# Package mariadb-server conflicts with mariadb-server-galera
$mariadb_package_name = 'mariadb-server-galera'
$mariadb_present = 'absent'
}
ensure_packages(['mariadb-server'], {'ensure' => $mariadb_present})

View File

@ -4,3 +4,4 @@ PyYAML>=3.10
docutils>=0.11
pyOpenSSL>=16.2.0
netifaces
distro

View File

@ -26,6 +26,7 @@ from packstack.modules import puppet
from packstack.installer import basedefs
from packstack.installer import run_setup
from packstack.installer import validators
from packstack.plugins.nova_300 import distro
from ..test_base import FakePopen
from ..test_base import PackstackTestCaseMixin
@ -110,6 +111,10 @@ class CommandLineTestCase(PackstackTestCaseMixin, TestCase):
puppet.validate_logfile = lambda a: None
puppet.scan_logfile = lambda a: []
# mock distro.linux_distribution, it's does subprocess.check_output
# lsb_release -a
distro.linux_distribution = lambda: "CentOS"
# If there is a error in a plugin sys.exit() gets called, this masks
# the actual error that should be reported, so we replace it to
# raise Exception, packstack logging gives a more infomrative error