[Bugfix] 修复动态系统用户执行批量命令的bug

This commit is contained in:
ibuler
2020-03-16 15:23:15 +08:00
parent 2f9598ba49
commit 00b3c7c945
2 changed files with 8 additions and 3 deletions

View File

@@ -33,7 +33,12 @@ class CommandExecution(OrgModelMixin):
@property
def inventory(self):
return JMSInventory(self.hosts.all(), run_as=self.run_as.username)
if self.run_as.username_same_with_user:
username = self.user.username
else:
username = self.run_as.username
inv = JMSInventory(self.hosts.all(), run_as=username)
return inv
@property
def result(self):