Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 7e6b7b9

Browse files
committed
Bug fixes
1 parent d86f958 commit 7e6b7b9

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

openstack/orchestration/v1/stackevents/requests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ type ListResourceEventsOpts struct {
163163
SortDir SortDir `q:"sort_dir"`
164164
}
165165

166-
// ToResourceEventsListQuery formats a ListOpts into a query string.
167-
func (opts ListOpts) ToResourceEventsListQuery() (string, error) {
166+
// ToResourceEventListQuery formats a ListResourceEventsOpts into a query string.
167+
func (opts ListResourceEventsOpts) ToResourceEventListQuery() (string, error) {
168168
q, err := gophercloud.BuildQueryString(opts)
169169
if err != nil {
170170
return "", err

openstack/orchestration/v1/stacks/requests.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,15 @@ func (opts AdoptOpts) ToStackAdoptMap() (map[string]interface{}, error) {
237237
}
238238
s["stack_name"] = opts.Name
239239
Files := make(map[string]string)
240-
if opts.TemplateOpts == nil {
240+
if opts.AdoptStackData != "" {
241+
s["adopt_stack_data"] = opts.AdoptStackData
242+
} else if opts.TemplateOpts == nil {
241243
if opts.Template != "" {
242244
s["template"] = opts.Template
243245
} else if opts.TemplateURL != "" {
244246
s["template_url"] = opts.TemplateURL
245247
} else {
246-
return s, errors.New("Either Template or TemplateURL must be provided.")
248+
return s, errors.New("One of AdoptStackData, Template, TemplateURL or TemplateOpts must be provided.")
247249
}
248250
} else {
249251
if err := opts.TemplateOpts.Parse(); err != nil {
@@ -260,10 +262,6 @@ func (opts AdoptOpts) ToStackAdoptMap() (map[string]interface{}, error) {
260262
Files[k] = v
261263
}
262264
}
263-
if opts.AdoptStackData == "" {
264-
return s, errors.New("Required field 'AdoptStackData' not provided.")
265-
}
266-
s["adopt_stack_data"] = opts.AdoptStackData
267265

268266
if opts.DisableRollback != nil {
269267
s["disable_rollback"] = &opts.DisableRollback

0 commit comments

Comments
 (0)