[Update] 支持Windows批量命令

This commit is contained in:
BaiJiangJie
2019-12-21 19:44:25 +08:00
parent 78a227af3e
commit 1d30c1900d
3 changed files with 22 additions and 14 deletions

View File

@@ -63,7 +63,12 @@ class CommandExecution(models.Model):
if ok:
runner = CommandRunner(self.inventory)
try:
result = runner.execute(self.command, 'all')
host = self.hosts[0]
if host.is_windows():
shell = 'win_shell'
else:
shell = 'shell'
result = runner.execute(self.command, 'all', module=shell)
self.result = result.results_command
except SoftTimeLimitExceeded as e:
print("Run timeout than 60s")