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
This commit is contained in:
		@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
        require => Package['cronie'],
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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})
 | 
			
		||||
 
 | 
			
		||||
@@ -4,3 +4,4 @@ PyYAML>=3.10
 | 
			
		||||
docutils>=0.11
 | 
			
		||||
pyOpenSSL>=16.2.0
 | 
			
		||||
netifaces
 | 
			
		||||
distro
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user