Decrypt credentials obtained from DB during vim/cloud account creation 59/14559/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 12 Sep 2024 10:53:09 +0000 (12:53 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 12 Sep 2024 10:53:09 +0000 (12:53 +0200)
Change-Id: I26b6f2532e89e5c6fb83b7f3c3491cfd70cd4360
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/lcm.py

index c685ed1..f1770f5 100644 (file)
@@ -647,6 +647,13 @@ class Lcm:
             op_params = params
             db_vim = self.db.get_one("vim_accounts", {"_id": vim_id})
             vim_config = db_vim.get("config", {})
+            self.db.encrypt_decrypt_fields(
+                vim_config.get("credentials"),
+                "decrypt",
+                ["password", "secret"],
+                schema_version=db_vim["schema_version"],
+                salt=vim_id,
+            )
             self.logger.debug("Db Vim: {}".format(db_vim))
             if command in ("create", "created"):
                 self.logger.debug("Main config: {}".format(self.main_config.to_dict()))