diff --git a/ceph-iscsi.spec b/ceph-iscsi.spec index a3127a61f472c7ae2abcfb08df8d7dab69c4bb91..2a75afccb20fdf0467b2e80856997a9b8aafd3d4 100644 --- a/ceph-iscsi.spec +++ b/ceph-iscsi.spec @@ -22,7 +22,7 @@ Name: ceph-iscsi Version: 3.6 -Release: 1 +Release: 2 Group: System/Filesystems Summary: Python modules for Ceph iSCSI gateway configuration management %if 0%{?suse_version} @@ -32,7 +32,7 @@ License: GPLv3+ %endif URL: https://github.com/ceph/ceph-iscsi Source0: https://github.com/ceph/ceph-iscsi/archive/%{version}/%{name}-%{version}.tar.gz - +Patch01: switch-to-use-distro-to-get-the-release-version.patch BuildArch: noarch Obsoletes: ceph-iscsi-config @@ -207,5 +207,8 @@ ln -s service %{buildroot}%{_sbindir}/rcrbd-target-api %endif %changelog +* Thu May 09 2024 yanshuai - 3.6-2 +- rbd-target-api: switch to use distro to get the release version + * Tue Jan 03 2023 zhangdaolong - 3.6-1 - Created spec file for 3.6 release diff --git a/switch-to-use-distro-to-get-the-release-version.patch b/switch-to-use-distro-to-get-the-release-version.patch new file mode 100644 index 0000000000000000000000000000000000000000..0ec8cb2c747f85247841084ab530407a694fe1c6 --- /dev/null +++ b/switch-to-use-distro-to-get-the-release-version.patch @@ -0,0 +1,55 @@ +From 385b292c7206c87d2f1c27d54838e74b89419211 Mon Sep 17 00:00:00 2001 +From: Xiubo Li +Date: Wed, 17 Apr 2024 20:31:23 +0800 +Subject: [PATCH] rbd-target-api: switch to use distro to get the release + version + +The 'platform.linux_distribution()' has been deprecated since python +3.7. And we should switch to use the distro.version(), distro.id() +and distro.name() instead. + +Signed-off-by: Xiubo Li + +--- + ceph-iscsi.spec | 2 ++ + rbd-target-api.py | 4 ++-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/ceph-iscsi.spec b/ceph-iscsi.spec +index 2d76e08..aa541f2 100644 +--- a/ceph-iscsi.spec ++++ b/ceph-iscsi.spec +@@ -43,6 +43,7 @@ Requires: ceph-common >= 10.2.2 + %if 0%{?with_python2} + BuildRequires: python2-devel + BuildRequires: python2-setuptools ++Requires: python2-distro + Requires: python-rados >= 10.2.2 + Requires: python-rbd >= 10.2.2 + Requires: python-netifaces >= 0.10.4 +@@ -61,6 +62,7 @@ Requires: python2-requests + BuildRequires: python3-devel + BuildRequires: python3-setuptools + Requires: python3-rados >= 10.2.2 ++Requires: python3-distro + Requires: python3-rbd >= 10.2.2 + Requires: python3-netifaces >= 0.10.4 + Requires: python3-rtslib >= 2.1.fb68 +diff --git a/rbd-target-api.py b/rbd-target-api.py +index ae59d04..31a6435 100644 +--- a/rbd-target-api.py ++++ b/rbd-target-api.py +@@ -2777,8 +2777,8 @@ def pre_reqs_errors(): + + if dist in valid_dists: + if dist == 'rhel': +- import platform +- _, rel, _ = platform.linux_distribution(full_distribution_name=0) ++ import distro ++ rel = distro.version() + # CentOS formats a release similar 7.4.1708 + rel = float(".".join(rel.split('.')[:2])) + if rel < valid_dists[dist]: +-- +2.27.0 +