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 | Installs and configures Nova | ||||||
| """ | """ | ||||||
|  |  | ||||||
|  | import distro | ||||||
| import os | import os | ||||||
| import platform |  | ||||||
| import socket | import socket | ||||||
|  |  | ||||||
| from packstack.installer import basedefs | from packstack.installer import basedefs | ||||||
| @@ -38,7 +38,7 @@ PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') | |||||||
|  |  | ||||||
|  |  | ||||||
| def initConfig(controller): | def initConfig(controller): | ||||||
|     if platform.linux_distribution()[0] == "Fedora": |     if distro.linux_distribution()[0] == "Fedora": | ||||||
|         primary_netif = "em1" |         primary_netif = "em1" | ||||||
|         secondary_netif = "em2" |         secondary_netif = "em2" | ||||||
|     else: |     else: | ||||||
|   | |||||||
| @@ -16,10 +16,10 @@ | |||||||
| Plugin responsible for setting OpenStack global options | Plugin responsible for setting OpenStack global options | ||||||
| """ | """ | ||||||
|  |  | ||||||
|  | import distro | ||||||
| import os | import os | ||||||
| import re | import re | ||||||
| import logging | import logging | ||||||
| import platform |  | ||||||
| import glob | import glob | ||||||
| import os | import os | ||||||
| import uuid | import uuid | ||||||
| @@ -949,16 +949,16 @@ def initSequences(controller): | |||||||
|  |  | ||||||
|  |  | ||||||
| def is_rhel(): | 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): | def detect_os_and_version(host): | ||||||
|     server = utils.ScriptRunner(host) |     server = utils.ScriptRunner(host) | ||||||
|     server.append( |     server.append( | ||||||
|         'python -c "import platform; ' |         'python -c "import distro; ' | ||||||
|         'print platform.linux_distribution(full_distribution_name=0)[0]' |         'print distro.linux_distribution(full_distribution_name=0)[0]' | ||||||
|         '+\',\'+' |         '+\',\'+' | ||||||
|         'platform.linux_distribution()[1]"' |         'distro.linux_distribution()[1]"' | ||||||
|     ) |     ) | ||||||
|     try: |     try: | ||||||
|         rc, out = server.execute() |         rc, out = server.execute() | ||||||
|   | |||||||
| @@ -4,9 +4,9 @@ | |||||||
| Facter.add(:mariadb_provides_galera) do | Facter.add(:mariadb_provides_galera) do | ||||||
|   setcode do |   setcode do | ||||||
|     if Facter.value(:operatingsystem) == 'Fedora' and Facter.value(:operatingsystemmajrelease).to_i > 22 |     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 |     else | ||||||
|       command = 'repoquery --whatprovides mariadb-galera-server' |       command = 'repoquery --whatprovides mariadb-server-galera' | ||||||
|     end |     end | ||||||
|     output = Facter::Util::Resolution.exec(command) |     output = Facter::Util::Resolution.exec(command) | ||||||
|     (output =~ /mariadb-server-galera.*/) != nil |     (output =~ /mariadb-server-galera.*/) != nil | ||||||
|   | |||||||
| @@ -15,9 +15,14 @@ class packstack::keystone () | |||||||
|       class { 'keystone::cron::fernet_rotate': |       class { 'keystone::cron::fernet_rotate': | ||||||
|         require     => Service['crond'], |         require     => Service['crond'], | ||||||
|       } |       } | ||||||
|  |       package { 'cronie': | ||||||
|  |         ensure => 'installed', | ||||||
|  |         name   => 'cronie', | ||||||
|  |       } | ||||||
|       service { 'crond': |       service { 'crond': | ||||||
|         ensure  => 'running', |         ensure  => 'running', | ||||||
|         enable  => true, |         enable  => true, | ||||||
|  |         require => Package['cronie'], | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,8 +9,8 @@ class packstack::mariadb () | |||||||
|       $mariadb_package_name = 'mariadb-server-galera' |       $mariadb_package_name = 'mariadb-server-galera' | ||||||
|       $mariadb_present      = 'present' |       $mariadb_present      = 'present' | ||||||
|     } else  { |     } else  { | ||||||
|       # Package mariadb-server conflicts with mariadb-galera-server |       # Package mariadb-server conflicts with mariadb-server-galera | ||||||
|       $mariadb_package_name = 'mariadb-galera-server' |       $mariadb_package_name = 'mariadb-server-galera' | ||||||
|       $mariadb_present      = 'absent' |       $mariadb_present      = 'absent' | ||||||
|     } |     } | ||||||
|     ensure_packages(['mariadb-server'], {'ensure' => $mariadb_present}) |     ensure_packages(['mariadb-server'], {'ensure' => $mariadb_present}) | ||||||
|   | |||||||
| @@ -4,3 +4,4 @@ PyYAML>=3.10 | |||||||
| docutils>=0.11 | docutils>=0.11 | ||||||
| pyOpenSSL>=16.2.0 | pyOpenSSL>=16.2.0 | ||||||
| netifaces | netifaces | ||||||
|  | distro | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ from packstack.modules import puppet | |||||||
| from packstack.installer import basedefs | from packstack.installer import basedefs | ||||||
| from packstack.installer import run_setup | from packstack.installer import run_setup | ||||||
| from packstack.installer import validators | from packstack.installer import validators | ||||||
|  | from packstack.plugins.nova_300 import distro | ||||||
|  |  | ||||||
| from ..test_base import FakePopen | from ..test_base import FakePopen | ||||||
| from ..test_base import PackstackTestCaseMixin | from ..test_base import PackstackTestCaseMixin | ||||||
| @@ -110,6 +111,10 @@ class CommandLineTestCase(PackstackTestCaseMixin, TestCase): | |||||||
|         puppet.validate_logfile = lambda a: None |         puppet.validate_logfile = lambda a: None | ||||||
|         puppet.scan_logfile = lambda a: [] |         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 |         # 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 |         # the actual error that should be reported, so we replace it to | ||||||
|         # raise Exception, packstack logging gives a more infomrative error |         # raise Exception, packstack logging gives a more infomrative error | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user