Skip to content

Commit

Permalink
main app expects source[0] to be of type EDA
Browse files Browse the repository at this point in the history
  • Loading branch information
tarilabs committed Jul 27, 2023
1 parent c447bf8 commit e2c5382
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ private Payload(List<String> list) {
}

static Payload parsePayload(Map ruleSet) {
Map sources = (Map) ((Map) ((List) ruleSet.get("sources")).get(0)).get("EventSource");
Map sourcesArgs = (Map) sources.get("source_args");
Map eventsource = (Map) ((Map) ((List) ruleSet.get("sources")).get(0)).get("EventSource");
if (!eventsource.get("source_name").equals("generic")) {
// this class currently mimics behaviour of: https://github.com/ansible/event-driven-ansible/blob/main/extensions/eda/plugins/event_source/generic.py
// as such we should fail if the provided AST file (json variant) does not contain a `generic` EDA source as the sources[0].
throw new IllegalArgumentException("Was expecting EventSource to be of type generic, found instead: "+eventsource);
}
Map sourcesArgs = (Map) eventsource.get("source_args");
List<String> payloadList = new ArrayList<>();

int repeatCount = 1;
Expand Down

0 comments on commit e2c5382

Please sign in to comment.