mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-29 21:51:31 +00:00
[Update] 支持Windows批量命令
This commit is contained in:
@@ -228,7 +228,7 @@ class AdHocRunner:
|
||||
|
||||
class CommandRunner(AdHocRunner):
|
||||
results_callback_class = CommandResultCallback
|
||||
modules_choices = ('shell', 'raw', 'command', 'script')
|
||||
modules_choices = ('shell', 'raw', 'command', 'script', 'win_shell')
|
||||
|
||||
def execute(self, cmd, pattern, module='shell'):
|
||||
if module and module not in self.modules_choices:
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user