Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): return error on failed resource addition #19750

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(cli): return error on failed resource addition
  • Loading branch information
glinton committed Oct 14, 2020
commit 70821338db1d6adc218212e1e19c2d6a1f1c9363
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