mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-24 08:47:49 +00:00
fix(namespace): remove name validation for destroy and get
This commit is contained in:
parent
cef0a2b0b3
commit
7e4709c13f
@ -65,10 +65,6 @@ func (h *Headscale) CreateNamespace(name string) (*Namespace, error) {
|
|||||||
// DestroyNamespace destroys a Namespace. Returns error if the Namespace does
|
// DestroyNamespace destroys a Namespace. Returns error if the Namespace does
|
||||||
// not exist or if there are machines associated with it.
|
// not exist or if there are machines associated with it.
|
||||||
func (h *Headscale) DestroyNamespace(name string) error {
|
func (h *Headscale) DestroyNamespace(name string) error {
|
||||||
err := CheckNamespaceName(name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
namespace, err := h.GetNamespace(name)
|
namespace, err := h.GetNamespace(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errNamespaceNotFound
|
return errNamespaceNotFound
|
||||||
@ -131,10 +127,6 @@ func (h *Headscale) RenameNamespace(oldName, newName string) error {
|
|||||||
|
|
||||||
// GetNamespace fetches a namespace by name.
|
// GetNamespace fetches a namespace by name.
|
||||||
func (h *Headscale) GetNamespace(name string) (*Namespace, error) {
|
func (h *Headscale) GetNamespace(name string) (*Namespace, error) {
|
||||||
err := CheckNamespaceName(name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
namespace := Namespace{}
|
namespace := Namespace{}
|
||||||
if result := h.db.First(&namespace, "name = ?", name); errors.Is(
|
if result := h.db.First(&namespace, "name = ?", name); errors.Is(
|
||||||
result.Error,
|
result.Error,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user