perf: 优化报错内容

pull/10721/head
Aaron3S 2023-06-14 20:04:20 +08:00 committed by Jiangjie.Bai
parent 9e31a5064b
commit 2c2334b618
2 changed files with 3 additions and 2 deletions

View File

@ -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()

View File

@ -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)