From f6cf568c689ab3cf5eb5fd89135c2122e9ebea1f Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Wed, 9 Aug 2023 11:36:52 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=20ip=20=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=99=A8=20topo=20=E8=BF=87=E6=BB=A4=E6=89=80?= =?UTF-8?q?=E6=9C=89=E8=8A=82=E7=82=B9=E9=83=BD=E5=A4=B1=E6=95=88=E6=97=B6?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=89=80=E6=9C=89=20ip=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_plugins/cmdb_ip_picker/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pipeline_plugins/cmdb_ip_picker/utils.py b/pipeline_plugins/cmdb_ip_picker/utils.py index bdac41364e..8d6b4e9f93 100644 --- a/pipeline_plugins/cmdb_ip_picker/utils.py +++ b/pipeline_plugins/cmdb_ip_picker/utils.py @@ -250,6 +250,7 @@ def _inject_topo_params(self, topo_list): self.property_filters["module_property_filter"]["rules"].append( {"field": "bk_module_id", "operator": "in", "value": list(module_ids)} ) + return module_ids def dispatch(self, params): handle_func = getattr(self, f"{self.selector}_picker_handler") @@ -271,7 +272,10 @@ def topo_picker_handler(self, inputted_topo): topo选择情况 :params inputted_topo: 拓扑结构信息列表, list """ - self._inject_topo_params(inputted_topo) + module_ids = self._inject_topo_params(inputted_topo) + if not module_ids: + logger.warning(f"[topo_picker_handler] no module_ids, inputted_topo: {inputted_topo}") + return {"result": True, "data": [], "message": ""} host_info_result = self.fetch_host_ip_with_property_filter() if not host_info_result["result"]: return host_info_result