From d67ce29284e178b81d7cc0ce8e52963ca79116f3 Mon Sep 17 00:00:00 2001 From: Fabian Seidl <fabian.seidl@h-da.de> Date: Fri, 11 Nov 2022 11:17:42 +0000 Subject: [PATCH] Resolve "Clean up deafult pnd uuid in toml files" See merge request danet/gosdn!400 --- .gitignore | 1 + cli/config/gosdnc.toml | 0 cli/config/gosdnc.toml.example | 4 ++++ controller/configs/containerlab-gosdn.toml.example | 3 --- controller/configs/development-gosdn.toml.example | 3 --- controller/northbound/server/user.go | 4 +--- 6 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 cli/config/gosdnc.toml create mode 100644 cli/config/gosdnc.toml.example diff --git a/.gitignore b/.gitignore index ebb933fbc..fc66c8dcc 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ stores/*.json # gosdn configs/gosdn.toml +config/.gosdnc.toml applications/venv-manager/*.clab.yaml diff --git a/cli/config/gosdnc.toml b/cli/config/gosdnc.toml deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/config/gosdnc.toml.example b/cli/config/gosdnc.toml.example new file mode 100644 index 000000000..1f79dc009 --- /dev/null +++ b/cli/config/gosdnc.toml.example @@ -0,0 +1,4 @@ +cli_pnd = '5f20f34b-cbd0-4511-9ddc-c50cf6a3b49d' +cli_sbi = 'ca29311a-3b17-4385-96f8-515b602a97ac' +controllerapiendpoint = 'localhost:55055' +user_token = '' diff --git a/controller/configs/containerlab-gosdn.toml.example b/controller/configs/containerlab-gosdn.toml.example index abe7167bd..2f33cbe76 100644 --- a/controller/configs/containerlab-gosdn.toml.example +++ b/controller/configs/containerlab-gosdn.toml.example @@ -1,13 +1,10 @@ basepnduuid = "5f20f34b-cbd0-4511-9ddc-c50cf6a3b49d" basesouthboundtype = 1 basesouthbounduuid = "ca29311a-3b17-4385-96f8-515b602a97ac" -cli_pnd = "0455b241-5863-4660-ad15-dfde7617738e" -cli_sbi = "a249f2d2-f7da-481d-8a99-b7f11471e0af" csbi-orchestrator = "clab-gosdn_csbi_arista_base-csbi-orchestrator:55056" help = false plugin-folder = "plugins" log-level = "debug" -pnduuid = "bf8160d4-4659-4a1b-98fd-f409a04111ec" socket = ":55055" databaseConnection = "mongodb://root:example@clab-gosdn_csbi_arista_base-mongodb:27017" filesystemPathToStores = "stores" diff --git a/controller/configs/development-gosdn.toml.example b/controller/configs/development-gosdn.toml.example index 820c76f13..74d196f15 100644 --- a/controller/configs/development-gosdn.toml.example +++ b/controller/configs/development-gosdn.toml.example @@ -1,13 +1,10 @@ basepnduuid = "5f20f34b-cbd0-4511-9ddc-c50cf6a3b49d" basesouthboundtype = 1 basesouthbounduuid = "ca29311a-3b17-4385-96f8-515b602a97ac" -cli_pnd = "0455b241-5863-4660-ad15-dfde7617738e" -cli_sbi = "a249f2d2-f7da-481d-8a99-b7f11471e0af" csbi-orchestrator = "localhost:55056" help = false plugin-folder = "plugins" log-level = "debug" -pnduuid = "bf8160d4-4659-4a1b-98fd-f409a04111ec" socket = ":55055" databaseConnection = "mongodb://root:example@localhost:27017" filesystemPathToStores = "stores" diff --git a/controller/northbound/server/user.go b/controller/northbound/server/user.go index 239823c25..e46718d84 100644 --- a/controller/northbound/server/user.go +++ b/controller/northbound/server/user.go @@ -65,9 +65,7 @@ func (u UserServer) CreateUsers(ctx context.Context, request *apb.CreateUsersReq hashedPassword := base64.RawStdEncoding.EncodeToString(argon2.IDKey([]byte(user.Password), []byte(salt), 1, 64*1024, 4, 32)) - user := rbac.NewUser(uuid.New(), user.Name, roles, string(hashedPassword), user.Token, salt, conflict.Metadata{ - ResourceVersion: int(user.Metadata.ResourceVersion), - }) + user := rbac.NewUser(uuid.New(), user.Name, roles, string(hashedPassword), user.Token, salt, conflict.Metadata{ResourceVersion: 0}) err = u.userService.Add(user) if err != nil { log.Error(err) -- GitLab