Skip to content

Commit

Permalink
fix(dcd): fixes NPE if template does not have variables (#1283)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeach committed Apr 18, 2017
1 parent 758689d commit 5852d53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions orca-pipelinetemplate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Then start the pipeline by sending a start `managedTemplate` pipeline request wi
{
"type": "templatedPipeline",
"config": {
"schema": "1",
"pipeline":{
"name": "My fancy DCD pipeline",
"application": "yourAppName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ public void visitPipelineTemplate(PipelineTemplate pipelineTemplate) {
private void render(PipelineTemplate template) {
RenderContext context = new DefaultRenderContext(templateConfiguration.getPipeline().getApplication(), template, trigger);

template.getVariables().stream()
.filter(Variable::hasDefaultValue)
.forEach(v -> context.getVariables().put(v.getName(), v.getDefaultValue()));
if (template.getVariables() != null) {
template.getVariables().stream()
.filter(Variable::hasDefaultValue)
.forEach(v -> context.getVariables().put(v.getName(), v.getDefaultValue()));
}

context.getVariables().putAll(templateConfiguration.getPipeline().getVariables());

Expand Down

0 comments on commit 5852d53

Please sign in to comment.