1 Star 0 Fork 78

Nic/ceph

forked from openEuler-RISC-V/ceph 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0011-fix-no-module-named-v1_event-for-mgr-k8sevent.patch 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
From a4c108a75e1240403813c96c022161a7ca33bbae Mon Sep 17 00:00:00 2001
From: liyuanyuan <liyuanyuan@xfusion.com>
Date: Thu, 15 Dec 2022 21:41:04 +0800
Subject: [PATCH] fix no module named v1_event for mgr/k8sevent
---
src/pybind/mgr/k8sevents/module.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/pybind/mgr/k8sevents/module.py b/src/pybind/mgr/k8sevents/module.py
index 1e12d1f27..66235e8f8 100644
--- a/src/pybind/mgr/k8sevents/module.py
+++ b/src/pybind/mgr/k8sevents/module.py
@@ -53,6 +53,9 @@ finally:
event_queue = queue.Queue()
try:
+ import kubernetes
+ from distutils.version import StrictVersion
+
from kubernetes import client, config, watch
from kubernetes.client.rest import ApiException
except ImportError:
@@ -67,7 +70,10 @@ else:
# which causes an exception in the generator. A workaround is discussed for a similar issue
# in https://github.com/kubernetes-client/python/issues/376 which has been used here
# pylint: disable=no-member
- from kubernetes.client.models.v1_event import V1Event
+ if kubernetes.__version__ <= StrictVersion("18.20.0"):
+ from kubernetes.client.models.v1_event import V1Event
+ else:
+ from kubernetes.client.models.core_v1_event import CoreV1Event as V1Event
def local_involved_object(self, involved_object):
if involved_object is None:
involved_object = client.V1ObjectReference(api_version="1")
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dominic_z/ceph.git
git@gitee.com:dominic_z/ceph.git
dominic_z
ceph
ceph
master

搜索帮助