Skip to content

Commit

Permalink
Support the test parameter on state.apply
Browse files Browse the repository at this point in the history
  • Loading branch information
renner committed Apr 20, 2018
1 parent 573cd7f commit 5793e44
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/com/suse/salt/netapi/calls/modules/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,22 @@ public <R> R getChanges(TypeToken<R> dataType) {
private State() { }

public static LocalCall<Map<String, ApplyResult>> apply(List<String> mods) {
return apply(mods, Optional.empty(), Optional.empty());
return apply(mods, Optional.empty(), Optional.empty(), Optional.empty());
}

public static LocalCall<Map<String, ApplyResult>> apply(String... mods) {
return apply(Arrays.asList(mods), Optional.empty(), Optional.empty());
return apply(Arrays.asList(mods), Optional.empty(), Optional.empty(),
Optional.empty());
}

public static LocalCall<Map<String, ApplyResult>> apply(List<String> mods,
Optional<Map<String, Object>> pillar, Optional<Boolean> queue) {
Optional<Map<String, Object>> pillar, Optional<Boolean> queue,
Optional<Boolean> test) {
Map<String, Object> kwargs = new LinkedHashMap<>();
kwargs.put("mods", mods);
pillar.ifPresent(p -> kwargs.put("pillar", p));
queue.ifPresent(q -> kwargs.put("queue", q));
test.ifPresent(t -> kwargs.put("test", t));
return new LocalCall<>("state.apply", Optional.empty(), Optional.of(kwargs),
new TypeToken<Map<String, ApplyResult>>(){});
}
Expand Down

0 comments on commit 5793e44

Please sign in to comment.