From e5a0daa134060cb5cd4efa472f4274dc1eba3c8f Mon Sep 17 00:00:00 2001 From: Francis Chuang Date: Thu, 21 Mar 2024 15:18:53 +1100 Subject: [PATCH] Fix role existence check --- path_roles.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/path_roles.go b/path_roles.go index e4893f0..8b61391 100644 --- a/path_roles.go +++ b/path_roles.go @@ -178,12 +178,12 @@ func pathRole(b *grafanaBackend) []*framework.Path { } func (b *grafanaBackend) pathRoleExistenceCheck(ctx context.Context, req *logical.Request, d *framework.FieldData) (bool, error) { - _, err := b.getRole(ctx, req.Storage, d.Get("name").(string)) + entry, err := b.getRole(ctx, req.Storage, d.Get("name").(string)) if err != nil { return false, err } - return true, nil + return entry != nil, nil } func (b *grafanaBackend) pathRolesList(ctx context.Context, req *logical.Request, d *framework.FieldData) (*logical.Response, error) {