Skip to content

Commit

Permalink
error if server profile template cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
FalcoSuessgott authored and Tom Morelly committed Feb 13, 2024
1 parent 4380d78 commit e552730
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions oneview/data_source_server_profile_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package oneview

import (
"fmt"
"log"
"reflect"

Expand Down Expand Up @@ -1068,14 +1069,10 @@ func dataSourceServerProfileTemplateRead(d *schema.ResourceData, meta interface{
name := d.Get("name").(string)

spt, err := config.ovClient.GetProfileTemplateByName(name)

if err != nil {
d.SetId("")
return err
} else if spt.URI.IsNil() {
d.SetId("")
return nil
if err != nil || spt.URI.IsNil() {
return fmt.Errorf("error fetching server profile template: %w", err)
}

d.Set("affinity", spt.Affinity)
d.Set("category", spt.Category)
d.Set("created", spt.Created)
Expand Down

0 comments on commit e552730

Please sign in to comment.