From 8a9ff3718a9e691272caa120ec522f41e3e3356b Mon Sep 17 00:00:00 2001 From: Slach Date: Wed, 14 Aug 2024 10:11:53 +0400 Subject: [PATCH] fix corner case for backup/restore RBAC object with trailing slash, warn /clickhouse/access//uuid have no children, skip Dump --- pkg/keeper/keeper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/keeper/keeper.go b/pkg/keeper/keeper.go index 794e1335..6e8d522d 100644 --- a/pkg/keeper/keeper.go +++ b/pkg/keeper/keeper.go @@ -108,7 +108,11 @@ func (k *Keeper) GetReplicatedAccessPath(userDirectory string) (string, error) { if zookeeperPathNode == nil { return "", fmt.Errorf("can't find %s in %s", xPathQuery, k.xmlConfigFile) } - return strings.TrimSuffix(zookeeperPathNode.InnerText(), "/"), nil + zookeeperPath := zookeeperPathNode.InnerText() + if zookeeperPath != "/" { + zookeeperPath = strings.TrimSuffix(zookeeperPathNode.InnerText(), "/") + } + return zookeeperPath, nil } func (k *Keeper) Dump(prefix, dumpFile string) (int, error) {