Skip to content

Commit

Permalink
change dump format
Browse files Browse the repository at this point in the history
  • Loading branch information
balanza committed Nov 7, 2024
1 parent c045e4a commit 6991fdb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/mix/tasks/dump_scenario.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ defmodule Mix.Tasks.DumpScenario do
events = Discovery.get_current_discovery_events()

Enum.map(events, fn %DiscoveryEvent{
id: id,
agent_id: agent_id,
discovery_type: discovery_type,
payload: payload
Expand All @@ -72,8 +73,10 @@ defmodule Mix.Tasks.DumpScenario do
scenario_path = Path.join(path, scenario_name)
File.mkdir_p!(scenario_path)

index = id |> Integer.to_string() |> String.pad_leading(4, "0")

scenario_path
|> Path.join("#{agent_id}_#{discovery_type}.json")
|> Path.join("#{index}_#{agent_id}_#{discovery_type}.json")
|> File.write!(data)
end)
end
Expand Down

0 comments on commit 6991fdb

Please sign in to comment.