Skip to content

Commit 266df53

Browse files
authored
Merge pull request #1181 from splunk/replay_file_path
replay_file_path
2 parents c0d3904 + 304a8e6 commit 266df53

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
@@ -502,6 +502,10 @@ def dump(self, dump_name, search, earliest, latest) -> None:
502502
self.logger.info("[Completed]")
503503

504504
def replay(self, file_name, index, sourcetype, source) -> None:
505+
### check if input log file is afile path or just a file name
506+
### if file name ,assume it is in current working dir of attack_range.py
507+
if Path(file_name).parent == Path("."):
508+
file_name = str(Path("../..")/file_name)
505509
ansible_vars = {}
506510
ansible_vars["file_name"] = file_name
507511
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

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

392392
def replay(self, file_name, index, sourcetype, source) -> None:
393+
### check if input log file is afile path or just a file name
394+
### if file name ,assume it is in current working dir of attack_range.py
395+
if Path(file_name).parent == Path("."):
396+
file_name = str(Path("../..")/file_name)
393397
ansible_vars = {}
394398
ansible_vars["file_name"] = file_name
395399
ansible_vars["ansible_user"] = "ubuntu"

0 commit comments

Comments
 (0)