Skip to content

Commit

Permalink
Hide internal outputs from porter installation outputs list
Browse files Browse the repository at this point in the history
Do not include internal outputs, such as porter-state.tgz when listing
outputs.

Signed-off-by: Carolyn Van Slyck <[email protected]>
  • Loading branch information
carolynvs committed Sep 15, 2021
1 parent a628df6 commit 3864352
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/porter/outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func NewDisplayValuesFromOutputs(bun cnab.ExtendedBundle, outputs claims.Outputs
displayOutputs := make(DisplayValues, 0, outputs.Len())
for i := 0; i < outputs.Len(); i++ {
output, _ := outputs.GetByIndex(i)

if bun.IsInternalOutput(output.Name) {
continue
}

do := &DisplayValue{Name: output.Name}
do.SetValue(output.Value)
schema, ok := output.GetSchema(bun)
Expand Down
9 changes: 9 additions & 0 deletions pkg/porter/outputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func TestPorter_PrintBundleOutputs(t *testing.T) {
"longfoo": &definition.Schema{
Type: "string",
},
"porter-state": &definition.Schema{
Type: "string",
Comment: "porter-internal", // This output should be hidden because it's internal
},
},
Outputs: map[string]bundle.Output{
"foo": {
Expand All @@ -91,6 +95,10 @@ func TestPorter_PrintBundleOutputs(t *testing.T) {
"longfoo": {
Definition: "longfoo",
},
"porter-state": {
Definition: "porter-state",
Path: "/cnab/app/outputs/porter-state.tgz",
},
},
}

Expand All @@ -100,6 +108,7 @@ func TestPorter_PrintBundleOutputs(t *testing.T) {
p.TestClaims.CreateOutput(r.NewOutput("foo", []byte("foo-output")))
p.TestClaims.CreateOutput(r.NewOutput("bar", []byte("bar-output")))
p.TestClaims.CreateOutput(r.NewOutput("longfoo", []byte("DFo6Wc2jDhmA7Yt4PbHyh8RO4vVG7leOzK412gf2TXNPJhuCUs1rB29nkJJd4ICimZGpyWpMGalSvDxf")))
p.TestClaims.CreateOutput(r.NewOutput("porter-state", []byte("porter-state.tgz contents")))

opts := OutputListOptions{
sharedOptions: sharedOptions{
Expand Down

0 comments on commit 3864352

Please sign in to comment.