Fix merge conflict

This commit is contained in:
Kristoffer Dalby 2021-11-14 08:30:48 +00:00
commit 052883aa55
4 changed files with 82 additions and 14 deletions

View file

@ -15,9 +15,9 @@ import (
)
const (
errorNamespaceExists = Error("Namespace already exists")
errorNamespaceNotFound = Error("Namespace not found")
errorNamespaceNotEmpty = Error("Namespace not empty")
errorNamespaceExists = Error("Namespace already exists")
errorNamespaceNotFound = Error("Namespace not found")
errorNamespaceNotEmptyOfNodes = Error("Namespace not empty: node(s) found")
)
// Namespace is the way Headscale implements the concept of users in Tailscale
@ -60,7 +60,18 @@ func (h *Headscale) DestroyNamespace(name string) error {
return err
}
if len(m) > 0 {
return errorNamespaceNotEmpty
return errorNamespaceNotEmptyOfNodes
}
keys, err := h.ListPreAuthKeys(name)
if err != nil {
return err
}
for _, p := range keys {
err = h.DestroyPreAuthKey(&p)
if err != nil {
return err
}
}
if result := h.db.Unscoped().Delete(&n); result.Error != nil {