mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
refactor: introduce render in commands wrapper for property string (#7430)
This commit is contained in:
@@ -32,6 +32,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static io.kestra.core.utils.Rethrow.throwFunction;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class CommandsWrapper implements TaskCommands {
|
||||
@@ -265,6 +267,17 @@ public class CommandsWrapper implements TaskCommands {
|
||||
);
|
||||
}
|
||||
|
||||
public String render(RunContext runContext, Property<String> command) throws IllegalVariableEvaluationException, IOException {
|
||||
TaskRunner<?> taskRunner = this.getTaskRunner();
|
||||
if (command == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return runContext.render(command).as(String.class, taskRunner.additionalVars(runContext, this))
|
||||
.map(throwFunction(c -> ScriptService.replaceInternalStorage(runContext, c, taskRunner instanceof RemoteRunnerInterface)))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public List<String> renderCommands(RunContext runContext, Property<List<String>> commands) throws IllegalVariableEvaluationException, IOException {
|
||||
TaskRunner<?> taskRunner = this.getTaskRunner();
|
||||
return ScriptService.replaceInternalStorage(
|
||||
|
||||
Reference in New Issue
Block a user