Update ELevate patch

This commit is contained in:
Andrew Lukoshko 2023-03-13 16:33:02 +01:00
parent 09046ed604
commit 2d63448e48
2 changed files with 214 additions and 56 deletions

View File

@ -1061,14 +1061,43 @@ index 0000000..74ba425
+ log.debug("Copying repo file {} to {}".format(repofile, REPO_ROOT_PATH)) + log.debug("Copying repo file {} to {}".format(repofile, REPO_ROOT_PATH))
+ +
+ shutil.copy(full_repo_path, REPO_ROOT_PATH) + shutil.copy(full_repo_path, REPO_ROOT_PATH)
diff --git a/repos/system_upgrade/cloudlinux/actors/backupmysqldata/actor.py b/repos/system_upgrade/cloudlinux/actors/backupmysqldata/actor.py
new file mode 100644
index 0000000..8e0f0e2
--- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/backupmysqldata/actor.py
@@ -0,0 +1,22 @@
+import os
+from leapp.actors import Actor
+from leapp.tags import InterimPreparationPhaseTag, IPUWorkflowTag
+from leapp.libraries.common.cllaunch import run_on_cloudlinux
+from leapp.libraries.common.backup import backup_file, CLSQL_BACKUP_FILES
+
+
+class BackupMySqlData(Actor):
+ """
+ Backup cl-mysql configuration data to an external folder.
+ """
+
+ name = 'backup_my_sql_data'
+ consumes = ()
+ produces = ()
+ tags = (InterimPreparationPhaseTag.Before, IPUWorkflowTag)
+
+ @run_on_cloudlinux
+ def process(self):
+ for filename in CLSQL_BACKUP_FILES:
+ if os.path.isfile(filename):
+ backup_file(filename, os.path.basename(filename))
diff --git a/repos/system_upgrade/cloudlinux/actors/checkcllicense/actor.py b/repos/system_upgrade/cloudlinux/actors/checkcllicense/actor.py diff --git a/repos/system_upgrade/cloudlinux/actors/checkcllicense/actor.py b/repos/system_upgrade/cloudlinux/actors/checkcllicense/actor.py
new file mode 100644 new file mode 100644
index 0000000..2c935d7 index 0000000..7934a9c
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/checkcllicense/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/checkcllicense/actor.py
@@ -0,0 +1,41 @@ @@ -0,0 +1,42 @@
+from leapp.actors import Actor +from leapp.actors import Actor
+from leapp import reporting +from leapp import reporting
+from leapp.reporting import Report
+from leapp.tags import ChecksPhaseTag, IPUWorkflowTag +from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
+from leapp.libraries.stdlib import CalledProcessError, run +from leapp.libraries.stdlib import CalledProcessError, run
+from leapp.libraries.common.cllaunch import run_on_cloudlinux +from leapp.libraries.common.cllaunch import run_on_cloudlinux
@ -1083,7 +1112,7 @@ index 0000000..2c935d7
+ +
+ name = 'check_cl_license' + name = 'check_cl_license'
+ consumes = () + consumes = ()
+ produces = () + produces = (Report,)
+ tags = (ChecksPhaseTag, IPUWorkflowTag) + tags = (ChecksPhaseTag, IPUWorkflowTag)
+ +
+ system_id_path = '/etc/sysconfig/rhn/systemid' + system_id_path = '/etc/sysconfig/rhn/systemid'
@ -1361,12 +1390,13 @@ index 0000000..149bce2
+ +
diff --git a/repos/system_upgrade/cloudlinux/actors/checkrhnversionoverride/actor.py b/repos/system_upgrade/cloudlinux/actors/checkrhnversionoverride/actor.py diff --git a/repos/system_upgrade/cloudlinux/actors/checkrhnversionoverride/actor.py b/repos/system_upgrade/cloudlinux/actors/checkrhnversionoverride/actor.py
new file mode 100644 new file mode 100644
index 0000000..d832d34 index 0000000..2321bde
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/checkrhnversionoverride/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/checkrhnversionoverride/actor.py
@@ -0,0 +1,38 @@ @@ -0,0 +1,39 @@
+from leapp.actors import Actor +from leapp.actors import Actor
+from leapp import reporting +from leapp import reporting
+from leapp.reporting import Report
+from leapp.tags import ChecksPhaseTag, IPUWorkflowTag +from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
+from leapp.libraries.common.cllaunch import run_on_cloudlinux +from leapp.libraries.common.cllaunch import run_on_cloudlinux
+ +
@ -1378,7 +1408,7 @@ index 0000000..d832d34
+ +
+ name = 'check_rhn_version_override' + name = 'check_rhn_version_override'
+ consumes = () + consumes = ()
+ produces = () + produces = (Report,)
+ tags = (ChecksPhaseTag, IPUWorkflowTag) + tags = (ChecksPhaseTag, IPUWorkflowTag)
+ +
+ @run_on_cloudlinux + @run_on_cloudlinux
@ -1387,7 +1417,7 @@ index 0000000..d832d34
+ with open(up2date_config, 'r') as f: + with open(up2date_config, 'r') as f:
+ config_data = f.readlines() + config_data = f.readlines()
+ for line in config_data: + for line in config_data:
+ if line.startswith('versionOverride=') and line != 'versionOverride=': + if line.startswith('versionOverride=') and line.strip() != 'versionOverride=':
+ title = 'RHN up2date: versionOverride not empty' + title = 'RHN up2date: versionOverride not empty'
+ summary = ('The RHN config file up2date has a set value of the versionOverride option.' + summary = ('The RHN config file up2date has a set value of the versionOverride option.'
+ ' This value will get overwritten by the upgrade process, and non-supported values' + ' This value will get overwritten by the upgrade process, and non-supported values'
@ -1542,10 +1572,10 @@ index 0000000..4651580
+ clmysqlrepositorysetup.process() + clmysqlrepositorysetup.process()
diff --git a/repos/system_upgrade/cloudlinux/actors/clmysqlrepositorysetup/libraries/clmysqlrepositorysetup.py b/repos/system_upgrade/cloudlinux/actors/clmysqlrepositorysetup/libraries/clmysqlrepositorysetup.py diff --git a/repos/system_upgrade/cloudlinux/actors/clmysqlrepositorysetup/libraries/clmysqlrepositorysetup.py b/repos/system_upgrade/cloudlinux/actors/clmysqlrepositorysetup/libraries/clmysqlrepositorysetup.py
new file mode 100644 new file mode 100644
index 0000000..2d73dbb index 0000000..1d5e4a0
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/clmysqlrepositorysetup/libraries/clmysqlrepositorysetup.py +++ b/repos/system_upgrade/cloudlinux/actors/clmysqlrepositorysetup/libraries/clmysqlrepositorysetup.py
@@ -0,0 +1,218 @@ @@ -0,0 +1,254 @@
+import os +import os
+ +
+from leapp.models import ( +from leapp.models import (
@ -1610,13 +1640,14 @@ index 0000000..2d73dbb
+def process(): +def process():
+ mysql_types = [] + mysql_types = []
+ clmysql_type = None + clmysql_type = None
+ custom_repo_msgs = []
+ +
+ for repofile_full in os.listdir(REPO_DIR): + for repofile_full in os.listdir(REPO_DIR):
+ # Don't touch non-repository files or copied repofiles created by Leapp. + # Don't touch non-repository files or copied repofiles created by Leapp.
+ if repofile_full.endswith(LEAPP_COPY_SUFFIX) or not repofile_full.endswith(REPOFILE_SUFFIX): + if repofile_full.endswith(LEAPP_COPY_SUFFIX) or not repofile_full.endswith(REPOFILE_SUFFIX):
+ continue + continue
+ # Cut the .repo part to get only the name. + # Cut the .repo part to get only the name.
+ repofile_name = repofile_full[:-5] + repofile_name = repofile_full[:-len(REPOFILE_SUFFIX)]
+ full_repo_path = os.path.join(REPO_DIR, repofile_full) + full_repo_path = os.path.join(REPO_DIR, repofile_full)
+ +
+ # Parse any repository files that may have something to do with MySQL or MariaDB. + # Parse any repository files that may have something to do with MySQL or MariaDB.
@ -1625,7 +1656,12 @@ index 0000000..2d73dbb
+ # Process CL-provided options. + # Process CL-provided options.
+ if any(mark in repofile_name for mark in CL_MARKERS): + if any(mark in repofile_name for mark in CL_MARKERS):
+ repofile_data = repofileutils.parse_repofile(full_repo_path) + repofile_data = repofileutils.parse_repofile(full_repo_path)
+ api.current_logger().debug('Data from repofile: {}'.format(repofile_data.data)) + data_to_log = [
+ (repo_data.repoid, "enabled" if repo_data.enabled else "disabled")
+ for repo_data in repofile_data.data
+ ]
+
+ api.current_logger().debug('repoids from CloudLinux repofile {}: {}'.format(repofile_name, data_to_log))
+ +
+ # Were any repositories enabled? + # Were any repositories enabled?
+ for repo in repofile_data.data: + for repo in repofile_data.data:
@ -1635,15 +1671,14 @@ index 0000000..2d73dbb
+ repo.repoid = repo.repoid + '-8' + repo.repoid = repo.repoid + '-8'
+ # releasever may be something like 8.6, while only 8 is acceptable. + # releasever may be something like 8.6, while only 8 is acceptable.
+ repo.baseurl = repo.baseurl.replace('/cl$releasever/', '/cl8/') + repo.baseurl = repo.baseurl.replace('/cl$releasever/', '/cl8/')
+
+ # mysqlclient is usually disabled when installed from CL MySQL Governor. + # mysqlclient is usually disabled when installed from CL MySQL Governor.
+ # However, it should be enabled for the Leapp upgrade, seeing as some packages + # However, it should be enabled for the Leapp upgrade, seeing as some packages
+ # from it won't update otherwise. + # from it won't update otherwise.
+
+ if repo.enabled or repo.repoid == 'mysqclient-8': + if repo.enabled or repo.repoid == 'mysqclient-8':
+ mysql_types.append('cloudlinux')
+ clmysql_type = get_clmysql_type() + clmysql_type = get_clmysql_type()
+ api.current_logger().debug('Generating custom cl-mysql repo: {}'.format(repo.repoid)) + api.current_logger().debug('Generating custom cl-mysql repo: {}'.format(repo.repoid))
+ api.produce(CustomTargetRepository( + custom_repo_msgs.append(CustomTargetRepository(
+ repoid=repo.repoid, + repoid=repo.repoid,
+ name=repo.name, + name=repo.name,
+ baseurl=repo.baseurl, + baseurl=repo.baseurl,
@ -1651,7 +1686,12 @@ index 0000000..2d73dbb
+ )) + ))
+ +
+ if any(repo.enabled for repo in repofile_data.data): + if any(repo.enabled for repo in repofile_data.data):
+ mysql_types.append('cloudlinux')
+ produce_leapp_repofile_copy(repofile_data, repofile_name) + produce_leapp_repofile_copy(repofile_data, repofile_name)
+ else:
+ api.current_logger().debug("No repos from CloudLinux repofile {} enabled, ignoring".format(
+ repofile_name
+ ))
+ +
+ # Process MariaDB options. + # Process MariaDB options.
+ elif any(mark in repofile_name for mark in MARIA_MARKERS): + elif any(mark in repofile_name for mark in MARIA_MARKERS):
@ -1664,13 +1704,12 @@ index 0000000..2d73dbb
+ # We want to replace the 7 in OS name after /yum/ + # We want to replace the 7 in OS name after /yum/
+ repo.repoid = repo.repoid + '-8' + repo.repoid = repo.repoid + '-8'
+ if repo.enabled: + if repo.enabled:
+ mysql_types.append('mariadb')
+ url_parts = repo.baseurl.split('yum') + url_parts = repo.baseurl.split('yum')
+ url_parts[1] = 'yum' + url_parts[1].replace('7', '8') + url_parts[1] = 'yum' + url_parts[1].replace('7', '8')
+ repo.baseurl = ''.join(url_parts) + repo.baseurl = ''.join(url_parts)
+ +
+ api.current_logger().debug('Generating custom MariaDB repo: {}'.format(repo.repoid)) + api.current_logger().debug('Generating custom MariaDB repo: {}'.format(repo.repoid))
+ api.produce(CustomTargetRepository( + custom_repo_msgs.append(CustomTargetRepository(
+ repoid=repo.repoid, + repoid=repo.repoid,
+ name=repo.name, + name=repo.name,
+ baseurl=repo.baseurl, + baseurl=repo.baseurl,
@ -1680,7 +1719,12 @@ index 0000000..2d73dbb
+ if any(repo.enabled for repo in repofile_data.data): + if any(repo.enabled for repo in repofile_data.data):
+ # Since MariaDB URLs have major versions written in, we need a new repo file + # Since MariaDB URLs have major versions written in, we need a new repo file
+ # to feed to the target userspace. + # to feed to the target userspace.
+ mysql_types.append('mariadb')
+ produce_leapp_repofile_copy(repofile_data, repofile_name) + produce_leapp_repofile_copy(repofile_data, repofile_name)
+ else:
+ api.current_logger().debug("No repos from MariaDB repofile {} enabled, ignoring".format(
+ repofile_name
+ ))
+ +
+ # Process MySQL options. + # Process MySQL options.
+ elif any(mark in repofile_name for mark in MYSQL_MARKERS): + elif any(mark in repofile_name for mark in MYSQL_MARKERS):
@ -1688,7 +1732,6 @@ index 0000000..2d73dbb
+ +
+ for repo in repofile_data.data: + for repo in repofile_data.data:
+ if repo.enabled: + if repo.enabled:
+ mysql_types.append('mysql')
+ # MySQL package repos don't have these versions available for EL8 anymore. + # MySQL package repos don't have these versions available for EL8 anymore.
+ # There'll be nothing to upgrade to. + # There'll be nothing to upgrade to.
+ # CL repositories do provide them, though. + # CL repositories do provide them, though.
@ -1718,7 +1761,7 @@ index 0000000..2d73dbb
+ repo.repoid = repo.repoid + '-8' + repo.repoid = repo.repoid + '-8'
+ repo.baseurl = repo.baseurl.replace('/el/7/', '/el/8/') + repo.baseurl = repo.baseurl.replace('/el/7/', '/el/8/')
+ api.current_logger().debug('Generating custom MySQL repo: {}'.format(repo.repoid)) + api.current_logger().debug('Generating custom MySQL repo: {}'.format(repo.repoid))
+ api.produce(CustomTargetRepository( + custom_repo_msgs.append(CustomTargetRepository(
+ repoid=repo.repoid, + repoid=repo.repoid,
+ name=repo.name, + name=repo.name,
+ baseurl=repo.baseurl, + baseurl=repo.baseurl,
@ -1726,28 +1769,51 @@ index 0000000..2d73dbb
+ )) + ))
+ +
+ if any(repo.enabled for repo in repofile_data.data): + if any(repo.enabled for repo in repofile_data.data):
+ mysql_types.append('mysql')
+ produce_leapp_repofile_copy(repofile_data, repofile_name) + produce_leapp_repofile_copy(repofile_data, repofile_name)
+ else:
+ api.current_logger().debug("No repos from MySQL repofile {} enabled, ignoring".format(
+ repofile_name
+ ))
+ +
+ if len(mysql_types) == 0: + if len(mysql_types) == 0:
+ api.current_logger().debug('No installed MySQL/MariaDB detected') + api.current_logger().debug('No installed MySQL/MariaDB detected')
+ elif len(mysql_types) == 1:
+ api.current_logger().debug('Detected MySQL/MariaDB type: {}, version: {}'.format(mysql_types[0], clmysql_type))
+ else: + else:
+ api.current_logger().warning('Detected multiple MySQL types: {}'.format(", ".join(mysql_types)))
+ reporting.create_report([ + reporting.create_report([
+ reporting.Title('Multpile MySQL/MariaDB versions detected'), + reporting.Title('MySQL database backup recommended'),
+ reporting.Summary( + reporting.Summary(
+ 'Package repositories for multiple distributions of MySQL/MariaDB ' + 'A MySQL/MariaDB installation has been detected on this machine. '
+ 'were detected on the system. ' + 'It is recommended to make a database backup before proceeding with the upgrade.'
+ 'Leapp will attempt to update all distributions detected. '
+ 'To update only the distribution you use, disable YUM package repositories for all '
+ 'other distributions. '
+ 'Detected: {0}'.format(", ".join(mysql_types))
+ ), + ),
+ reporting.Severity(reporting.Severity.MEDIUM), + reporting.Severity(reporting.Severity.HIGH),
+ reporting.Tags([reporting.Tags.REPOSITORY, reporting.Tags.OS_FACTS]), + reporting.Tags([reporting.Tags.REPOSITORY]),
+ ]) + ])
+ +
+ for msg in custom_repo_msgs:
+ api.produce(msg)
+
+ if len(mysql_types) == 1:
+ api.current_logger().debug(
+ "Detected MySQL/MariaDB type: {}, version: {}".format(
+ mysql_types[0], clmysql_type
+ )
+ )
+ else:
+ api.current_logger().warning('Detected multiple MySQL types: {}'.format(", ".join(mysql_types)))
+ reporting.create_report([
+ reporting.Title('Multpile MySQL/MariaDB versions detected'),
+ reporting.Summary(
+ 'Package repositories for multiple distributions of MySQL/MariaDB '
+ 'were detected on the system. '
+ 'Leapp will attempt to update all distributions detected. '
+ 'To update only the distribution you use, disable YUM package repositories for all '
+ 'other distributions. '
+ 'Detected: {0}'.format(", ".join(mysql_types))
+ ),
+ reporting.Severity(reporting.Severity.MEDIUM),
+ reporting.Tags([reporting.Tags.REPOSITORY, reporting.Tags.OS_FACTS]),
+ ])
+
+ if 'cloudlinux' in mysql_types and clmysql_type in MODULE_STREAMS.keys(): + if 'cloudlinux' in mysql_types and clmysql_type in MODULE_STREAMS.keys():
+ mod_name, mod_stream = MODULE_STREAMS[clmysql_type].split(':') + mod_name, mod_stream = MODULE_STREAMS[clmysql_type].split(':')
+ modules_to_enable = [Module(name=mod_name, stream=mod_stream)] + modules_to_enable = [Module(name=mod_name, stream=mod_stream)]
@ -1825,13 +1891,14 @@ index 0000000..4eed3ec
+ ) + )
diff --git a/repos/system_upgrade/cloudlinux/actors/enableyumspacewalkplugin/actor.py b/repos/system_upgrade/cloudlinux/actors/enableyumspacewalkplugin/actor.py diff --git a/repos/system_upgrade/cloudlinux/actors/enableyumspacewalkplugin/actor.py b/repos/system_upgrade/cloudlinux/actors/enableyumspacewalkplugin/actor.py
new file mode 100644 new file mode 100644
index 0000000..1e353b1 index 0000000..95fcce9
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/enableyumspacewalkplugin/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/enableyumspacewalkplugin/actor.py
@@ -0,0 +1,55 @@ @@ -0,0 +1,56 @@
+from leapp.actors import Actor +from leapp.actors import Actor
+from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag +from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag
+from leapp import reporting +from leapp import reporting
+from leapp.reporting import Report
+from leapp.libraries.common.cllaunch import run_on_cloudlinux +from leapp.libraries.common.cllaunch import run_on_cloudlinux
+ +
+try: +try:
@ -1852,7 +1919,7 @@ index 0000000..1e353b1
+ +
+ name = 'enable_yum_spacewalk_plugin' + name = 'enable_yum_spacewalk_plugin'
+ consumes = () + consumes = ()
+ produces = () + produces = (Report,)
+ tags = (FirstBootPhaseTag, IPUWorkflowTag) + tags = (FirstBootPhaseTag, IPUWorkflowTag)
+ +
+ config = '/etc/yum/pluginconf.d/spacewalk.conf' + config = '/etc/yum/pluginconf.d/spacewalk.conf'
@ -1957,10 +2024,10 @@ index 0000000..358403b
+ ) + )
diff --git a/repos/system_upgrade/cloudlinux/actors/replacerpmnewconfigs/actor.py b/repos/system_upgrade/cloudlinux/actors/replacerpmnewconfigs/actor.py diff --git a/repos/system_upgrade/cloudlinux/actors/replacerpmnewconfigs/actor.py b/repos/system_upgrade/cloudlinux/actors/replacerpmnewconfigs/actor.py
new file mode 100644 new file mode 100644
index 0000000..209d933 index 0000000..4ddb755
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/replacerpmnewconfigs/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/replacerpmnewconfigs/actor.py
@@ -0,0 +1,64 @@ @@ -0,0 +1,65 @@
+from __future__ import print_function +from __future__ import print_function
+import os +import os
+import fileinput +import fileinput
@ -2001,6 +2068,7 @@ index 0000000..209d933
+ os.rename(new_file_path, base_path) + os.rename(new_file_path, base_path)
+ renamed_repofiles.append(base_reponame) + renamed_repofiles.append(base_reponame)
+ +
+ # Disable any old repositories.
+ for reponame in os.listdir(REPO_DIR): + for reponame in os.listdir(REPO_DIR):
+ if LEAPP_BACKUP_SUFFIX in reponame: + if LEAPP_BACKUP_SUFFIX in reponame:
+ repofile_path = os.path.join(REPO_DIR, reponame) + repofile_path = os.path.join(REPO_DIR, reponame)
@ -2056,6 +2124,34 @@ index 0000000..21b2164
+ line = 'versionOverride=' + line = 'versionOverride='
+ with open(up2date_config, 'w') as f: + with open(up2date_config, 'w') as f:
+ f.writelines(config_data) + f.writelines(config_data)
diff --git a/repos/system_upgrade/cloudlinux/actors/restoremysqldata/actor.py b/repos/system_upgrade/cloudlinux/actors/restoremysqldata/actor.py
new file mode 100644
index 0000000..d1ec819
--- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/restoremysqldata/actor.py
@@ -0,0 +1,22 @@
+import os
+from leapp.actors import Actor
+from leapp.tags import ThirdPartyApplicationsPhaseTag, IPUWorkflowTag
+from leapp.libraries.common.cllaunch import run_on_cloudlinux
+from leapp.libraries.common.backup import restore_file, CLSQL_BACKUP_FILES
+
+
+class RestoreMySqlData(Actor):
+ """
+ Restore cl-mysql configuration data from an external folder.
+ """
+
+ name = 'restore_my_sql_data'
+ consumes = ()
+ produces = ()
+ tags = (ThirdPartyApplicationsPhaseTag, IPUWorkflowTag)
+
+ @run_on_cloudlinux
+ def process(self):
+ for filename in CLSQL_BACKUP_FILES:
+ if os.path.isfile(filename):
+ restore_file(filename, os.path.basename(filename))
diff --git a/repos/system_upgrade/cloudlinux/actors/scancontrolpanel/actor.py b/repos/system_upgrade/cloudlinux/actors/scancontrolpanel/actor.py diff --git a/repos/system_upgrade/cloudlinux/actors/scancontrolpanel/actor.py b/repos/system_upgrade/cloudlinux/actors/scancontrolpanel/actor.py
new file mode 100644 new file mode 100644
index 0000000..96524ed index 0000000..96524ed
@ -2182,16 +2278,17 @@ index 0000000..0a059f1
+ api.produce(CustomTargetRepositoryFile(file=full_repo_path)) + api.produce(CustomTargetRepositoryFile(file=full_repo_path))
diff --git a/repos/system_upgrade/cloudlinux/actors/switchclnchannel/actor.py b/repos/system_upgrade/cloudlinux/actors/switchclnchannel/actor.py diff --git a/repos/system_upgrade/cloudlinux/actors/switchclnchannel/actor.py b/repos/system_upgrade/cloudlinux/actors/switchclnchannel/actor.py
new file mode 100644 new file mode 100644
index 0000000..784075a index 0000000..79eb3e4
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/switchclnchannel/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/switchclnchannel/actor.py
@@ -0,0 +1,58 @@ @@ -0,0 +1,59 @@
+from leapp.actors import Actor +from leapp.actors import Actor
+from leapp.libraries.stdlib import api +from leapp.libraries.stdlib import api
+from leapp.tags import DownloadPhaseTag, IPUWorkflowTag +from leapp.tags import DownloadPhaseTag, IPUWorkflowTag
+from leapp.libraries.stdlib import CalledProcessError, run +from leapp.libraries.stdlib import CalledProcessError, run
+from leapp.libraries.common.cllaunch import run_on_cloudlinux +from leapp.libraries.common.cllaunch import run_on_cloudlinux
+from leapp import reporting +from leapp import reporting
+from leapp.reporting import Report
+ +
+ +
+class SwitchClnChannel(Actor): +class SwitchClnChannel(Actor):
@ -2201,7 +2298,7 @@ index 0000000..784075a
+ +
+ name = "switch_cln_channel" + name = "switch_cln_channel"
+ consumes = () + consumes = ()
+ produces = () + produces = (Report,)
+ tags = (IPUWorkflowTag, DownloadPhaseTag.Before) + tags = (IPUWorkflowTag, DownloadPhaseTag.Before)
+ +
+ switch_bin = "/usr/sbin/cln-switch-channel" + switch_bin = "/usr/sbin/cln-switch-channel"
@ -2246,16 +2343,15 @@ index 0000000..784075a
+ ) + )
diff --git a/repos/system_upgrade/cloudlinux/actors/updatecagefs/actor.py b/repos/system_upgrade/cloudlinux/actors/updatecagefs/actor.py diff --git a/repos/system_upgrade/cloudlinux/actors/updatecagefs/actor.py b/repos/system_upgrade/cloudlinux/actors/updatecagefs/actor.py
new file mode 100644 new file mode 100644
index 0000000..71e3c66 index 0000000..c6590d2
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/cloudlinux/actors/updatecagefs/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/updatecagefs/actor.py
@@ -0,0 +1,36 @@ @@ -0,0 +1,37 @@
+import os +import os
+ +
+from leapp.actors import Actor +from leapp.actors import Actor
+from leapp.libraries.stdlib import run, CalledProcessError +from leapp.libraries.stdlib import run, CalledProcessError
+from leapp.reporting import Report, create_report +from leapp.reporting import Report, create_report
+from leapp import reporting
+from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag +from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag
+from leapp.libraries.common.cllaunch import run_on_cloudlinux +from leapp.libraries.common.cllaunch import run_on_cloudlinux
+ +
@ -2269,7 +2365,7 @@ index 0000000..71e3c66
+ +
+ name = 'update_cagefs' + name = 'update_cagefs'
+ consumes = () + consumes = ()
+ produces = () + produces = (Report,)
+ tags = (FirstBootPhaseTag, IPUWorkflowTag) + tags = (FirstBootPhaseTag, IPUWorkflowTag)
+ +
+ @run_on_cloudlinux + @run_on_cloudlinux
@ -2281,11 +2377,68 @@ index 0000000..71e3c66
+ except CalledProcessError as e: + except CalledProcessError as e:
+ # cagefsctl prints errors in stdout + # cagefsctl prints errors in stdout
+ self.log.error(e.stdout) + self.log.error(e.stdout)
+ self.log.error('Command "cagefsctl --force-update" finished with exit code {}, ' + self.log.error
+ (
+ 'Command "cagefsctl --force-update" finished with exit code {}, '
+ 'the filesystem inside cagefs may be out-of-date.\n' + 'the filesystem inside cagefs may be out-of-date.\n'
+ 'Check cagefsctl output above and in /var/log/cagefs-update.log, ' + 'Check cagefsctl output above and in /var/log/cagefs-update.log, '
+ 'rerun "cagefsctl --force-update" after fixing the issues.'.format(e.exit_code) + 'rerun "cagefsctl --force-update" after fixing the issues.'.format(e.exit_code)
+ ) + )
diff --git a/repos/system_upgrade/cloudlinux/libraries/backup.py b/repos/system_upgrade/cloudlinux/libraries/backup.py
new file mode 100644
index 0000000..249c99e
--- /dev/null
+++ b/repos/system_upgrade/cloudlinux/libraries/backup.py
@@ -0,0 +1,49 @@
+import os
+import shutil
+from leapp.libraries.stdlib import api
+
+CLSQL_BACKUP_FILES = [
+ "/etc/container/dbuser-map",
+ "/etc/container/ve.cfg",
+ "/etc/container/mysql-governor.xml",
+ "/etc/container/governor_package_limit.json"
+]
+
+BACKUP_DIR = "/var/lib/leapp/cl_backup"
+
+
+def backup_file(source, destination, dir=None):
+ # type: (str, str, str) -> None
+ """
+ Backup file to a backup directory.
+
+ :param source: Path of the file to backup.
+ :param destination: Destination name of a file in the backup directory.
+ :param dir: Backup directory override, defaults to None
+ """
+ if not dir:
+ dir = BACKUP_DIR
+ if not os.path.isdir(dir):
+ os.makedirs(dir)
+
+ dest_path = os.path.join(dir, destination)
+
+ api.current_logger().debug('Backing up file: {} to {}'.format(source, dest_path))
+ shutil.copy(source, dest_path)
+
+
+def restore_file(source, destination, dir=None):
+ # type: (str, str, str) -> None
+ """
+ Restore file from a backup directory.
+
+ :param source: Name of a file in the backup directory.
+ :param destination: Destination path to restore the file to.
+ :param dir: Backup directory override, defaults to None
+ """
+ if not dir:
+ dir = BACKUP_DIR
+ src_path = os.path.join(dir, source)
+
+ api.current_logger().debug('Restoring file: {} to {}'.format(src_path, destination))
+ shutil.copy(src_path, destination)
diff --git a/repos/system_upgrade/cloudlinux/libraries/cllaunch.py b/repos/system_upgrade/cloudlinux/libraries/cllaunch.py diff --git a/repos/system_upgrade/cloudlinux/libraries/cllaunch.py b/repos/system_upgrade/cloudlinux/libraries/cllaunch.py
new file mode 100644 new file mode 100644
index 0000000..6cbab5d index 0000000..6cbab5d
@ -2590,10 +2743,10 @@ index 14bd6e3..f6adacf 100755
# stability, but check is better than broken system. # stability, but check is better than broken system.
diff --git a/repos/system_upgrade/common/actors/detectwebservers/actor.py b/repos/system_upgrade/common/actors/detectwebservers/actor.py diff --git a/repos/system_upgrade/common/actors/detectwebservers/actor.py b/repos/system_upgrade/common/actors/detectwebservers/actor.py
new file mode 100644 new file mode 100644
index 0000000..d600eb2 index 0000000..ac79714
--- /dev/null --- /dev/null
+++ b/repos/system_upgrade/common/actors/detectwebservers/actor.py +++ b/repos/system_upgrade/common/actors/detectwebservers/actor.py
@@ -0,0 +1,48 @@ @@ -0,0 +1,53 @@
+from leapp.actors import Actor +from leapp.actors import Actor
+from leapp import reporting +from leapp import reporting
+from leapp.reporting import Report +from leapp.reporting import Report
@ -2630,9 +2783,14 @@ index 0000000..d600eb2
+ "A web server is present on the system." + "A web server is present on the system."
+ " Depending on the source of installation, " + " Depending on the source of installation, "
+ " it may not upgrade to the new version correctly," + " it may not upgrade to the new version correctly,"
+ " since not all varoants are currently supported by Leapp." + " since not all installation configurations are currently supported by Leapp."
+ " Please check the list of packages that won't be upgraded in the report." + " Failing to upgrade the webserver may result in it malfunctioning"
+ " Alternatively, upgrade the webserver manually after the process finishes." + " after the upgrade process finishes."
+ " Please review the list of packages that won't be upgraded in the report."
+ " If the web server packages are present in the list of packages that won't be upgraded,"
+ " expect the server to be non-functional on the post-upgrade system."
+ " You may still continue with the upgrade, but you'll need to"
+ " upgrade the web server manually after the process finishes."
+ " Detected webserver: {}.".format(server_name) + " Detected webserver: {}.".format(server_name)
+ ), + ),
+ reporting.Severity(reporting.Severity.HIGH), + reporting.Severity(reporting.Severity.HIGH),
@ -4418,7 +4576,7 @@ index 6a2f5aa..51030fd 100644
mount_names = [mount_point.fs_file for mount_point in mount_points] mount_names = [mount_point.fs_file for mount_point in mount_points]
diff --git a/repos/system_upgrade/common/libraries/repofileutils.py b/repos/system_upgrade/common/libraries/repofileutils.py diff --git a/repos/system_upgrade/common/libraries/repofileutils.py b/repos/system_upgrade/common/libraries/repofileutils.py
index a3f111b..4f7ea91 100644 index a3f111b..26e4d3e 100644
--- a/repos/system_upgrade/common/libraries/repofileutils.py --- a/repos/system_upgrade/common/libraries/repofileutils.py
+++ b/repos/system_upgrade/common/libraries/repofileutils.py +++ b/repos/system_upgrade/common/libraries/repofileutils.py
@@ -26,6 +26,18 @@ def _parse_repository(repoid, repo_data): @@ -26,6 +26,18 @@ def _parse_repository(repoid, repo_data):
@ -4454,7 +4612,7 @@ index a3f111b..4f7ea91 100644
+ :type repofile_path: str + :type repofile_path: str
+ """ + """
+ with open(repofile_path, mode='w') as fp: + with open(repofile_path, mode='w') as fp:
+ cp = utils.create_config(repodata) + cp = utils.create_parser()
+ _prepare_config(repodata, cp) + _prepare_config(repodata, cp)
+ cp.write(fp) + cp.write(fp)
+ +
@ -4629,14 +4787,14 @@ index b7e4b21..dc038bf 100644
def with_rhsm(f): def with_rhsm(f):
diff --git a/repos/system_upgrade/common/libraries/utils.py b/repos/system_upgrade/common/libraries/utils.py diff --git a/repos/system_upgrade/common/libraries/utils.py b/repos/system_upgrade/common/libraries/utils.py
index 6793de6..8a38723 100644 index 6793de6..d201677 100644
--- a/repos/system_upgrade/common/libraries/utils.py --- a/repos/system_upgrade/common/libraries/utils.py
+++ b/repos/system_upgrade/common/libraries/utils.py +++ b/repos/system_upgrade/common/libraries/utils.py
@@ -43,6 +43,14 @@ def parse_config(cfg=None, strict=True): @@ -43,6 +43,14 @@ def parse_config(cfg=None, strict=True):
return parser return parser
+def create_config(repodata): +def create_parser(strict=True):
+ if six.PY3: + if six.PY3:
+ parser = six.moves.configparser.ConfigParser(strict=strict) # pylint: disable=unexpected-keyword-arg + parser = six.moves.configparser.ConfigParser(strict=strict) # pylint: disable=unexpected-keyword-arg
+ else: + else:
@ -4962,7 +5120,7 @@ index 923bf80..9972204 100755
print("{} processed, {} changed, {} errors".format(processed, changed, errors)) print("{} processed, {} changed, {} errors".format(processed, changed, errors))
diff --git a/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py b/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py diff --git a/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py b/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py
index f13a767..0ca198f 100644 index f13a767..2e3412d 100644
--- a/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py --- a/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py
+++ b/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py +++ b/repos/system_upgrade/el7toel8/actors/opensshpermitrootlogincheck/actor.py
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
@ -5002,8 +5160,8 @@ index f13a767..0ca198f 100644
+ 'to log onto this machine after the upgrade. ' + 'to log onto this machine after the upgrade. '
+ 'To prevent this from occuring, the PermitRootLogin option ' + 'To prevent this from occuring, the PermitRootLogin option '
+ 'has been explicity set to "yes" to preserve the default behaivour ' + 'has been explicity set to "yes" to preserve the default behaivour '
+ 'after migration.' + 'after migration. '
+ 'The original configuration file has been backed up to' + 'The original configuration file has been backed up to '
+ '/etc/ssh/sshd_config.leapp_backup' + '/etc/ssh/sshd_config.leapp_backup'
), ),
- reporting.Severity(reporting.Severity.HIGH), - reporting.Severity(reporting.Severity.HIGH),

View File

@ -43,7 +43,7 @@ py2_byte_compile "%1" "%2"}
Epoch: 1 Epoch: 1
Name: leapp-repository Name: leapp-repository
Version: 0.16.0 Version: 0.16.0
Release: 6%{?dist}.elevate.8 Release: 6%{?dist}.elevate.9
Summary: Repositories for leapp Summary: Repositories for leapp
License: ASL 2.0 License: ASL 2.0