Skip to content

Commit

Permalink
F #300: fix test for host existence at read
Browse files Browse the repository at this point in the history
  • Loading branch information
treywelsh committed Nov 29, 2022
1 parent 137da9c commit 164f8ab
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions opennebula/resource_opennebula_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,6 @@ func resourceOpennebulaHostRead(ctx context.Context, d *schema.ResourceData, met

hc, err := getHostController(d, meta)
if err != nil {
if NoExists(err) {
log.Printf("[WARN] Removing host %s from state because it no longer exists in", d.Get("name"))
d.SetId("")
return nil
}

diags = append(diags, diag.Diagnostic{
Severity: diag.Error,
Summary: "Failed to get the host controller",
Expand All @@ -301,6 +295,11 @@ func resourceOpennebulaHostRead(ctx context.Context, d *schema.ResourceData, met

hostInfos, err := hc.Info(false)
if err != nil {
if NoExists(err) {
log.Printf("[WARN] Removing host %s from state because it no longer exists in", d.Get("name"))
d.SetId("")
return nil
}
diags = append(diags, diag.Diagnostic{
Severity: diag.Error,
Summary: "Failed to retrieve informations",
Expand Down

0 comments on commit 164f8ab

Please sign in to comment.