While working on https://github.com/deislabs/cnab-go/pull/129, I noticed that cnab-go appends outputs to an operation regardless of if an output applies to a given action. I propose that the intended behavior be that an output is not appended if it does not apply to the action on the operation. Here's the proposed change (using some code additions from #129):
--- a/action/action.go
+++ b/action/action.go
@@ -213,7 +213,10 @@ func opFromClaim(action string, stateless bool, c *claim.Claim, ii bundle.Invoca
var outputs []string
if c.Bundle.Outputs != nil {
for _, v := range c.Bundle.Outputs {
- outputs = append(outputs, v.Path)
+ // Only add to list if output applies to the provided action
+ if v.AppliesTo(action) {
+ outputs = append(outputs, v.Path)
+ }
}
}
While working on https://github.com/deislabs/cnab-go/pull/129, I noticed that cnab-go appends outputs to an operation regardless of if an output applies to a given action. I propose that the intended behavior be that an output is not appended if it does not apply to the action on the operation. Here's the proposed change (using some code additions from #129):