From 7ee418d34301bde11805eb28e26397991e1aba40 Mon Sep 17 00:00:00 2001 From: shixuantong Date: Tue, 27 Feb 2024 09:56:49 +0800 Subject: [PATCH 1/2] add python3-passlib to BuildRequires --- cloud-init.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cloud-init.spec b/cloud-init.spec index ddbeffa..8fda87b 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 23.4.1 -Release: 1 +Release: 2 Summary: the defacto multi-distribution package that handles early initialization of a cloud instance. License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -20,7 +20,7 @@ BuildRequires: python3-jinja2 python3-jsonpatch python3-jsonschema BuildRequires: python3-mock python3-oauthlib python3-prettytable BuildRequires: python3-pyserial python3-PyYAML python3-requests BuildRequires: dnf %{_vendor}-release python3-pytest passwd python3-netifaces -BuildRequires: python3-pytest-mock +BuildRequires: python3-pytest-mock python3-passlib Requires: e2fsprogs iproute python3-libselinux net-tools python3-policycoreutils Requires: procps python3-configobj python3-jinja2 python3-jsonpatch xfsprogs @@ -119,6 +119,12 @@ fi %exclude /usr/share/doc/* %changelog +* Tue Feb 27 2024 shixuantong - 23.4.1-2 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:add python3-passlib to BuildRequires + * Wed Jan 24 2024 shixuantong - 23.4.1-1 - Type:enhancement - CVE:NA -- Gitee From c3956e013dcf1a7a4fdbda6d76fac077b66777ea Mon Sep 17 00:00:00 2001 From: shixuantong Date: Tue, 27 Feb 2024 10:29:15 +0800 Subject: [PATCH 2/2] test --- cloud-init.spec | 12 ++++++++++-- get_interfaces.py | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 get_interfaces.py diff --git a/cloud-init.spec b/cloud-init.spec index 8fda87b..9437411 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,12 +1,13 @@ Name: cloud-init Version: 23.4.1 -Release: 2 +Release: 3 Summary: the defacto multi-distribution package that handles early initialization of a cloud instance. License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init Source0: https://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz Source1: cloud-init-tmpfiles.conf +Source2: get_interfaces.py Patch0: cloud-init-22.1-no-override-default-network.patch Patch2: bugfix-sort-requirements.patch @@ -42,6 +43,7 @@ echo %{_vendor} sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/env python3|' \ -e 's|#!/usr/bin/python|#!/usr/bin/python3|' tools/* cloudinit/ssh_util.py sed -i 's/\/etc\/redhat-release/\/etc\/%{_vendor}-release/g' setup.py +cp %{SOURCE2} . %build %py3_build @@ -55,7 +57,13 @@ install -D -m 0644 %{SOURCE1} %{buildroot}/%{_tmpfilesdir}/%{name}.conf install -D -m 0644 tools/21-cloudinit.conf %{buildroot}/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf %check -python3 -m pytest tests/unittests/ +echo -e "********************************************\n" +ip a +echo -e "********************************************\n" +python3 get_interfaces.py +echo -e "********************************************\n" + +#python3 -m pytest tests/unittests/ %pre diff --git a/get_interfaces.py b/get_interfaces.py new file mode 100644 index 0000000..51a9835 --- /dev/null +++ b/get_interfaces.py @@ -0,0 +1,4 @@ +from cloudinit.net import get_interfaces + +for name, mac, driver, _devid in get_interfaces(): + print("name - {}, mac - {}, driver - {} , _devid - {}".format(name, mac, driver, _devid)) -- Gitee