Skip to content

Commit

Permalink
Evaluate settings values before passing it to task closure (elastic#2…
Browse files Browse the repository at this point in the history
…6243)

The secure settings tool reads from stdIn and we use a closure to
provide a value for this. Yet, we evaluate they value too late and end up
with the last provided value for all keys.
  • Loading branch information
s1monw authored Aug 16, 2017
1 parent cfad668 commit d26c8b5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ class ClusterFormationTasks {
String key = entry.getKey()
String name = taskName(parent, node, 'addToKeystore#' + key)
Task t = configureExecTask(name, project, parentTask, node, esKeystoreUtil, 'add', key, '-x')
String settingsValue = entry.getValue() // eval this early otherwise it will not use the right value
t.doFirst {
standardInput = new ByteArrayInputStream(entry.getValue().getBytes(StandardCharsets.UTF_8))
standardInput = new ByteArrayInputStream(settingsValue.getBytes(StandardCharsets.UTF_8))
}
parentTask = t
}
Expand Down

0 comments on commit d26c8b5

Please sign in to comment.