summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKefu Chai <tchaikov@gmail.com>2024-05-25 07:50:43 +0200
committerKefu Chai <tchaikov@gmail.com>2024-05-25 09:22:32 +0200
commit844b66de419d7bf5f622980b0de3c69b5ad8bc9c (patch)
treedcfbb17ccdfc686b626906a68bc8dfc709cc7004
parentMerge PR #57686 into main (diff)
downloadceph-844b66de419d7bf5f622980b0de3c69b5ad8bc9c.tar.xz
ceph-844b66de419d7bf5f622980b0de3c69b5ad8bc9c.zip
mgr/prometheus: s/pkg_resources.packaging/packaging/
instead of relying on the internal implementation of pkg_resources, let's import packaging directly. in this change, we also add the dependency to the packaging module in the packaging recipes. See also https://github.com/pypa/setuptools/issues/4385 Fixes https://tracker.ceph.com/issues/66201 Signed-off-by: Kefu Chai <tchaikov@gmail.com>
-rw-r--r--ceph.spec.in1
-rw-r--r--debian/ceph-mgr-modules-core.requires1
-rw-r--r--src/pybind/mgr/prometheus/module.py4
3 files changed, 4 insertions, 2 deletions
diff --git a/ceph.spec.in b/ceph.spec.in
index 151f332ff1d..459bce9ea28 100644
--- a/ceph.spec.in
+++ b/ceph.spec.in
@@ -723,6 +723,7 @@ BuildArch: noarch
Group: System/Filesystems
%endif
Requires: python%{python3_pkgversion}-bcrypt
+Requires: python%{python3_pkgversion}-packaging
Requires: python%{python3_pkgversion}-pecan
Requires: python%{python3_pkgversion}-pyOpenSSL
Requires: python%{python3_pkgversion}-requests
diff --git a/debian/ceph-mgr-modules-core.requires b/debian/ceph-mgr-modules-core.requires
index 9814e67b710..b5d37b3a9ce 100644
--- a/debian/ceph-mgr-modules-core.requires
+++ b/debian/ceph-mgr-modules-core.requires
@@ -1,5 +1,6 @@
natsort
CherryPy
+packaging
pecan
werkzeug
requests
diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py
index 45a6c9f0013..6f675e3be00 100644
--- a/src/pybind/mgr/prometheus/module.py
+++ b/src/pybind/mgr/prometheus/module.py
@@ -1,7 +1,6 @@
import cherrypy
import yaml
from collections import defaultdict
-from pkg_resources import packaging # type: ignore
import json
import math
import os
@@ -9,6 +8,7 @@ import re
import threading
import time
import enum
+from packaging import version # type: ignore
from collections import namedtuple
from mgr_module import CLIReadCommand, MgrModule, MgrStandbyModule, PG_STATES, Option, ServiceInfoT, HandleCommandResult, CLIWriteCommand
@@ -34,7 +34,7 @@ DEFAULT_PORT = 9283
# ipv6 isn't yet configured / supported and CherryPy throws an uncaught
# exception.
if cherrypy is not None:
- Version = packaging.version.Version
+ Version = version.Version
v = Version(cherrypy.__version__)
# the issue was fixed in 3.2.3. it's present in 3.2.2 (current version on
# centos:7) and back to at least 3.0.0.