Skip to content

Commit

Permalink
fix(executor): Properly handle empty resource results, like for a mis…
Browse files Browse the repository at this point in the history
…sing get (#3037)
  • Loading branch information
dmayle committed May 14, 2020
1 parent a1ac8bc commit 38a995b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions workflow/executor/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func (we *WorkflowExecutor) ExecResource(action string, manifestPath string, fla
if action == "delete" {
return "", "", nil
}
if action == "get" && len(out) == 0 {
return "", "", nil
}
obj := unstructured.Unstructured{}
err = json.Unmarshal(out, &obj)
if err != nil {
Expand Down Expand Up @@ -307,6 +310,14 @@ func (we *WorkflowExecutor) SaveResourceParameters(resourceNamespace string, res
if param.ValueFrom == nil {
continue
}
if resourceNamespace == "" && resourceName == "" {
output := ""
if param.ValueFrom.Default != nil {
output = string([]byte(*param.ValueFrom.Default))
}
we.Template.Outputs.Parameters[i].Value = &output
continue
}
var cmd *exec.Cmd
if param.ValueFrom.JSONPath != "" {
args := []string{"get", resourceName, "-o", fmt.Sprintf("jsonpath=%s", param.ValueFrom.JSONPath)}
Expand Down

0 comments on commit 38a995b

Please sign in to comment.