From af9f7060beb3348f092ce0aa95aedca18fa0da95 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Wed, 16 Aug 2023 17:01:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20shell=20=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E5=91=BD=E4=BB=A4=E6=97=A0=E6=B3=95=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/models/job.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/ops/models/job.py b/apps/ops/models/job.py index 23105f297..f27e6b309 100644 --- a/apps/ops/models/job.py +++ b/apps/ops/models/job.py @@ -60,7 +60,14 @@ class JMSPermedInventory(JMSInventory): host['error'] = _("No account available") return host - if protocol.name != self.module: + protocol_supported_modules_mapping = { + 'mysql': ['mysql'], + 'postgresql': ['postgresql'], + 'sqlserver': ['sqlserver'], + 'ssh': ['shell', 'python', 'win_shell'], + } + + if self.module not in protocol_supported_modules_mapping.get(protocol.name, []): host['error'] = "Module {} is not suitable for this asset".format(self.module) return host