Skip to content

Commit

Permalink
has non-terminal allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
pkazmierczak committed Jul 31, 2024
1 parent a18aacb commit 31181e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nomad/resource_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,17 @@ func resourceNamespaceDelete(d *schema.ResourceData, meta interface{}) error {
if d.Get("quota") != "" {
d.Set("quota", "")
err = resourceNamespaceWrite(d, meta)
if err != nil {
return err
}
}
_, err = client.Namespaces().Delete(name, nil)
}

if err == nil {
break
} else if retries < 10 {
if strings.Contains(err.Error(), "has non-terminal jobs") {
if strings.Contains(err.Error(), "has non-terminal jobs") || strings.Contains(err.Error(), "has non-terminal allocations") {
log.Printf("[WARN] could not delete namespace %q because of non-terminal jobs, will pause and retry", name)
time.Sleep(5 * time.Second)
retries++
Expand Down

0 comments on commit 31181e2

Please sign in to comment.