Skip to content

Commit

Permalink
Fix image "most_recent" selection
Browse files Browse the repository at this point in the history
  • Loading branch information
NeilW committed Dec 5, 2022
1 parent ac1906e commit 7408c7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.0.6 (December 5, 2022)

BUG FIXES:
- data/image - Fix 'most_recent' selection

## 3.0.5 (September 28, 2022)

BUG FIXES:
Expand Down
12 changes: 5 additions & 7 deletions brightbox/resource_brightbox_context_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,12 @@ func datasourceBrightboxRecentRead[O brightbox.CreateDated](

if len(results) > 1 {
recent, ok := d.GetOk("most_recent")
if ok {
if recent.(bool) {
log.Printf("[DEBUG] Multiple results found and `most_recent` is set")
result = mostRecent(results)
}
if !ok || !recent.(bool) {
return diag.Errorf("Your query returned more than one result (found %d entries). Please try a more "+
"specific search criteria.", len(results))
}
return diag.Errorf("Your query returned more than one result (found %d entries). Please try a more "+
"specific search criteria.", len(results))
log.Printf("[DEBUG] Multiple results found and `most_recent` is set")
result = mostRecent(results)
} else if len(results) < 1 {
return diag.Errorf("Your query returned no results. " +
"Please change your search criteria and try again.")
Expand Down

0 comments on commit 7408c7a

Please sign in to comment.