)
import logging
+from time import time
from osm_lcm.lcm_utils import LcmBase
from copy import deepcopy
from osm_lcm import odu_workflows
self.db.del_one("clusters", {"_id": db_cluster["_id"]})
return
- async def get_creds(self, db_cluster):
+ async def get_creds(self, op_id, db_cluster):
self.logger.info("Cluster get creds Enter")
result, cluster_creds = await self.odu.get_cluster_credentials(db_cluster)
if result:
db_cluster["credentials"] = cluster_creds
- self.db.set_one("clusters", {"_id": db_cluster["_id"]}, db_cluster)
+ op_len = 0
+ for operations in db_cluster["operationHistory"]:
+ if operations["op_id"] == op_id:
+ db_cluster["operationHistory"][op_len]["result"] = result
+ db_cluster["operationHistory"][op_len]["endDate"] = time()
+ op_len += 1
+ self.db.set_one("clusters", {"_id": db_cluster["_id"]}, db_cluster)
return
async def update(self, op_id, op_params, content):
)
return
elif command == "get_creds":
- cluster_id = params["_id"]
+ cluster_id = params["cluster_id"]
+ op_id = params["operation_id"]
db_cluster = self.db.get_one("clusters", {"_id": cluster_id})
- task = asyncio.ensure_future(self.cluster.get_creds(db_cluster))
+ task = asyncio.ensure_future(self.cluster.get_creds(op_id, db_cluster))
self.lcm_tasks.register(
"cluster", cluster_id, cluster_id, "cluster_get_credentials", task
)