From 2c2334b61863a0e357c0cc471d3f5e6550623aa8 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Wed, 14 Jun 2023 20:04:20 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/ansible/runner.py | 3 ++- apps/ops/models/job.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ops/ansible/runner.py b/apps/ops/ansible/runner.py index ac83d0d8e..03aec1787 100644 --- a/apps/ops/ansible/runner.py +++ b/apps/ops/ansible/runner.py @@ -32,7 +32,8 @@ class AdHocRunner: if self.module not in self.cmd_modules_choices: return if self.module_args and self.module_args.split()[0] in settings.SECURITY_COMMAND_BLACKLIST: - raise CommandInBlackListException("command not allowed:{}".format(self.module_args.split()[0])) + raise CommandInBlackListException( + "Command is rejected by black list: {}".format(self.module_args.split()[0])) def run(self, verbosity=0, **kwargs): self.check_module() diff --git a/apps/ops/models/job.py b/apps/ops/models/job.py index 932a948b0..b655fc095 100644 --- a/apps/ops/models/job.py +++ b/apps/ops/models/job.py @@ -451,7 +451,7 @@ class JobExecution(JMSOrgBaseModel): self.set_result(cb) return cb except CommandInBlackListException as e: - print("command is rejected by black list: {}".format(e)) + print(e) except Exception as e: logging.error(e, exc_info=True) self.set_error(e)