Skip to content

Commit

Permalink
fix(cli): return error on failed resource addition (#19750)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored Oct 15, 2020
1 parent 447ae59 commit 8c0ff75
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/influx/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,9 +895,11 @@ func (b *cmdTemplateBuilder) stackUpdateRunEFn(cmd *cobra.Command, args []string
TemplateURLs: b.urls,
}

failedString := []string{}
for _, res := range b.updateStackOpts.addResources {
parts := strings.SplitN(res, "=", 2)
if len(parts) < 2 {
failedString = append(failedString, res)
continue
}

Expand All @@ -917,6 +919,10 @@ func (b *cmdTemplateBuilder) stackUpdateRunEFn(cmd *cobra.Command, args []string
})
}

if len(failedString) > 0 {
return errors.New("invalid 'resourceType=resourceID' key value pair[s]: " + strings.Join(failedString, ";"))
}

stack, err := templateSVC.UpdateStack(context.Background(), update)
if err != nil {
return err
Expand Down

0 comments on commit 8c0ff75

Please sign in to comment.