Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/attackmate/executors/baseexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@ def run(self, command: BaseCommand) -> Result:
self.logger.debug(f"Template-Command: '{command.cmd}'")
if command.background:
# Background commands always return Result(None,None)
time_of_execution = datetime.now().isoformat()
self.log_json(self.json_logger, command, time_of_execution)
result = self.exec_background(self.substitute_template_vars(command, self.substitute_cmd_vars))
else:
result = self.exec(self.substitute_template_vars(command, self.substitute_cmd_vars))

return result


def log_command(self, command):
"""Log starting-status of the command"""
self.logger.info(f"Executing '{command}'")
Expand Down
4 changes: 3 additions & 1 deletion src/attackmate/executors/features/background.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from attackmate.schemas.base import BaseCommand
from attackmate.processmanager import ProcessManager
from attackmate.result import Result
Expand Down Expand Up @@ -30,7 +31,8 @@ def _create_queue(self) -> Optional[Queue]:

def exec_background(self, command: BaseCommand) -> Result:
self.logger.info(f'Run in background: {getattr(command, "type", "")}({command.cmd})')

if command.metadata:
self.logger.info(f'Metadata: {json.dumps(command.metadata)}')
queue = self._create_queue()

if queue:
Expand Down