Skip to content

Commit 304a8e6

Browse files
committed
replay_file_path
1 parent 54f5f7c commit 304a8e6

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

modules/ansible/roles/data_replay/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: Upload replay
44
copy:
5-
src: ../../{{ file_name }}
5+
src: "{{ file_name }}"
66
dest: /tmp/data.log
77

88
- name: Call oneshot import

modules/aws_controller.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ def dump(self, dump_name, search, earliest, latest) -> None:
396396
self.logger.info("[Completed]")
397397

398398
def replay(self, file_name, index, sourcetype, source) -> None:
399+
### check if input log file is afile path or just a file name
400+
### if file name ,assume it is in current working dir of attack_range.py
401+
if Path(file_name).parent == Path("."):
402+
file_name = str(Path("../..")/file_name)
399403
ansible_vars = {}
400404
ansible_vars["file_name"] = file_name
401405
ansible_vars["ansible_user"] = "ubuntu"

modules/azure_controller.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from modules.attack_range_controller import AttackRangeController
1313
from modules.art_simulation_controller import ArtSimulationController
1414
from modules.purplesharp_simulation_controller import PurplesharpSimulationController
15-
15+
from pathlib import Path
1616

1717
class AzureController(AttackRangeController):
1818

@@ -287,6 +287,10 @@ def dump(self, dump_name, search, earliest, latest) -> None:
287287
self.logger.info("[Completed]")
288288

289289
def replay(self, file_name, index, sourcetype, source) -> None:
290+
### check if input log file is afile path or just a file name
291+
### if file name ,assume it is in current working dir of attack_range.py
292+
if Path(file_name).parent == Path("."):
293+
file_name = str(Path("../..")/file_name)
290294
ansible_vars = {}
291295
ansible_vars["file_name"] = file_name
292296
ansible_vars["ansible_user"] = "ubuntu"

0 commit comments

Comments
 (0)