1 Star 0 Fork 10

崔立昊/leapp

forked from anolis/leapp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0014-add-checkglibc.patch 4.24 KB
一键复制 编辑 原始数据 按行查看 历史
Meredith 提交于 2021-08-27 10:48 . add leapp-repository related files
From 09faa4508f1861e2845d8fd83f8700c061e12017 Mon Sep 17 00:00:00 2001
From: Chunmei Xu <xuchunmei@openanolis.org>
Date: Mon, 26 Jul 2021 19:32:16 +0800
Subject: [PATCH] add checkglibc
show changes about nis module and /etc/nsswitch.conf
Signed-off-by: Chunmei Xu <xuchunmei@openanolis.org>
---
.../el7toel8/actors/checkglibc/actor.py | 34 +++++++++++++++++++
.../tests/component_test_checkglibc.py | 33 ++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 repos/system_upgrade/el7toel8/actors/checkglibc/actor.py
create mode 100644 repos/system_upgrade/el7toel8/actors/checkglibc/tests/component_test_checkglibc.py
diff --git a/repos/system_upgrade/el7toel8/actors/checkglibc/actor.py b/repos/system_upgrade/el7toel8/actors/checkglibc/actor.py
new file mode 100644
index 0000000..145602f
--- /dev/null
+++ b/repos/system_upgrade/el7toel8/actors/checkglibc/actor.py
@@ -0,0 +1,34 @@
+from leapp.actors import Actor
+from leapp.libraries.common.rpms import has_package
+from leapp.models import InstalledRedHatSignedRPM
+from leapp.reporting import Report, create_report
+from leapp import reporting
+from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
+
+
+class CheckGlibc(Actor):
+ """
+ Show important changes of glibc
+ """
+
+ name = 'checkglibc'
+ consumes = (InstalledRedHatSignedRPM,)
+ produces = (Report,)
+ tags = (ChecksPhaseTag, IPUWorkflowTag)
+
+ def process(self):
+ if has_package(InstalledRedHatSignedRPM, 'glibc'):
+ create_report([
+ reporting.Title('Some important changes about glibc'),
+ reporting.Summary(
+ 'The GLIBC version of Anolis8 is 2.28. '
+ 'This version no longer supports nss related modules, '
+ 'no longer providing libnss_nis.so, libnss_nisplus.so. \n'
+ '/etc/nsswitch.conf deletes all configurations related to nis. '
+ 'The fast cache mechanism provided by the sssd can enhance the parsing performance of user and groups, '
+ '/etc/nsswitch.conf defaults to set the preferences for passwd and group for sss.\n'
+ 'All code that relies and uses the nis module requires rectification, you can use tirpc instead.'
+ ),
+ reporting.Severity(reporting.Severity.HIGH),
+ reporting.RelatedResource('package', 'glibc')
+ ])
diff --git a/repos/system_upgrade/el7toel8/actors/checkglibc/tests/component_test_checkglibc.py b/repos/system_upgrade/el7toel8/actors/checkglibc/tests/component_test_checkglibc.py
new file mode 100644
index 0000000..83780d8
--- /dev/null
+++ b/repos/system_upgrade/el7toel8/actors/checkglibc/tests/component_test_checkglibc.py
@@ -0,0 +1,33 @@
+from leapp.snactor.fixture import current_actor_context
+from leapp.models import InstalledRedHatSignedRPM, RPM
+from leapp.reporting import Report
+
+RH_PACKAGER = 'Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>'
+
+
+def create_modulesfacts(installed_rpm):
+ return InstalledRedHatSignedRPM(items=installed_rpm)
+
+
+def test_actor_with_glibc_package(current_actor_context):
+ with_glibc = [
+ RPM(name='glibc', version='2.28', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
+ pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'),
+ RPM(name='powertop', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
+ pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51')]
+
+ current_actor_context.feed(create_modulesfacts(installed_rpm=with_glibc))
+ current_actor_context.run()
+ assert current_actor_context.consume(Report)
+
+
+def test_actor_without_glibc_package(current_actor_context):
+ without_glibc = [
+ RPM(name='powertop', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
+ pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'),
+ RPM(name='sed', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch',
+ pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51')]
+
+ current_actor_context.feed(create_modulesfacts(installed_rpm=without_glibc))
+ current_actor_context.run()
+ assert not current_actor_context.consume(Report)
--
2.29.2
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cui-lihao/leapp.git
git@gitee.com:cui-lihao/leapp.git
cui-lihao
leapp
leapp
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385