Skip to content

Commit

Permalink
B #517: wait for resource deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
treywelsh authored and frousselet committed Jan 19, 2024
1 parent baa508b commit fd407e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FEATURES:

* **New Resource**: `opennebula_marketplace` (#414)
* **New Data Source**: `opennebula_marketplace` (#414)
* **New Resource**: `opennebula_marketplace_appliance` (#476, #518)
* **New Resource**: `opennebula_marketplace_appliance` (#476, #517, #518)
* **New Data Source**: `opennebula_marketplace_appliance` (#476)
* resources/opennebula_virtual_router_nic: add floating IP allocation (#510)

Expand Down
12 changes: 12 additions & 0 deletions opennebula/resource_opennebula_marketplace_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func resourceOpennebulaMarketPlaceApp() *schema.Resource {
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(defaultMarketAppTimeout),
Update: schema.DefaultTimeout(defaultMarketAppTimeout),
Delete: schema.DefaultTimeout(defaultMarketAppTimeout),
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
Expand Down Expand Up @@ -812,6 +813,17 @@ func resourceOpennebulaMarketPlaceAppDelete(ctx context.Context, d *schema.Resou
return diags
}

timeout := d.Timeout(schema.TimeoutDelete)
_, err = waitForMarketAppStates(ctx, ac, timeout, []string{app.Ready.String(), app.Locked.String(), app.Init.String(), app.Locked.String(), app.Disabled.String()}, []string{"notfound"})
if err != nil {
diags = append(diags, diag.Diagnostic{
Severity: diag.Error,
Summary: "Failed to wait marketplace appliance to be removed",
Detail: fmt.Sprintf("marketplace appliance (ID: %s): %s", d.Id(), err),
})
return diags
}

return nil
}

Expand Down

0 comments on commit fd407e8

Please sign in to comment.