self.logger.debug("Db Vim: {}".format(db_vim))
if command in ("create", "created"):
self.logger.debug("Main config: {}".format(self.main_config.to_dict()))
- if "credentials" in vim_config:
+ if "credentials" or "credentials_base64" in vim_config:
self.logger.info("Vim add cloud credentials")
task = asyncio.ensure_future(
self.cloud_credentials.add(op_id, op_params, db_vim)
#######################################################################################
-import yaml
+import base64
import json
+import yaml
+from osm_lcm.lcm_utils import LcmException
async def create_cloud_credentials(self, op_id, op_params, content):
secret_name = workflow_name
secret_namespace = "osm-workflows"
secret_key = "creds"
- secret_value = json.dumps(content["config"]["credentials"], indent=2)
+ cloud_config = content.get("config", {})
+ if "credentials_base64" in cloud_config:
+ secret_value = base64.b64decode(cloud_config["credentials_base64"]).decode(
+ "utf-8"
+ )
+ elif "credentials" in cloud_config:
+ secret_value = json.dumps(cloud_config["credentials"], indent=2)
+ else:
+ raise LcmException("No credentials in VIM/cloud config")
await self.create_secret(
secret_name,
secret_namespace,
secret_name = workflow_name
secret_namespace = "osm-workflows"
secret_key = "creds"
- secret_value = json.dumps(content["config"]["credentials"], indent=2)
+ cloud_config = content.get("config", {})
+ if "credentials_base64" in cloud_config:
+ secret_value = base64.b64decode(cloud_config["credentials_base64"]).decode(
+ "utf-8"
+ )
+ elif "credentials" in cloud_config:
+ secret_value = json.dumps(cloud_config["credentials"], indent=2)
+ else:
+ raise LcmException("No credentials in VIM/cloud config")
await self.create_secret(
secret_name,
secret_namespace,