Skip to content
Snippets Groups Projects
Commit e08aff15 authored by Shahithya Y's avatar Shahithya Y Committed by garciadeblas
Browse files

Update operationHistory and response for create operation


Change-Id: I89aec4ce42e8f4ccc5471aa63acb202435a2acc8
Signed-off-by: default avataryshah <shahithya.y@tataelxsi.co.in>
parent b9eb4142
No related branches found
No related tags found
No related merge requests found
......@@ -432,7 +432,8 @@ class BaseTopic:
if launch_workflow:
operation["workflowState"] = "PROCESSING"
operation["resourceState"] = "NOT_READY"
operation["git_operation_info"] = None
operation["operationState"] = "IN_PROGRESS"
operation["gitOperationInfo"] = None
operation["operationParams"] = operation_params
content["operationHistory"].append(operation)
......
......@@ -527,7 +527,10 @@ class K8sTopic(BaseTopic):
filter_db = self._get_project_filter(session)
# To allow project&user addressing by name AS WELL AS _id
filter_db[BaseTopic.id_field(self.topic, _id)] = _id
op_id = str(uuid4())
operation_params = {}
data = self.db.get_one(self.topic, filter_db)
data["current_operation"] = op_id
data["operatingState"] = "PROCESSING"
data["resourceState"] = "IN_PROGRESS"
operation_params = indata
......@@ -537,7 +540,6 @@ class K8sTopic(BaseTopic):
operation_params,
)
self.db.set_one(self.topic, {"_id": _id}, data)
op_id = data["current_operation"]
data = {"cluster_id": _id, "operation_id": op_id}
self._send_msg(item, data)
return op_id
......
......@@ -1872,7 +1872,7 @@ class Server(object):
self._set_location_header(main_topic, version, topic, _id)
else:
cherrypy.response.headers["Transaction-Id"] = _id
outdata = {"_id": _id}
outdata = {"_id": _id, "id": _id}
elif topic == "ns_instances_content":
# creates NSR
_id, _ = self.engine.new_item(
......@@ -1994,7 +1994,7 @@ class Server(object):
rollback, engine_session, engine_topic, indata, kwargs
)
self._set_location_header(main_topic, version, topic, _id)
outdata = {"id": _id}
outdata = {"_id": _id, "id": _id}
elif (
topic
in (
......@@ -2011,7 +2011,7 @@ class Server(object):
rollback, engine_session, engine_topic, indata, kwargs
)
self._set_location_header(main_topic, version, topic, _id)
outdata = {"_id": _id}
outdata = {"_id": _id, "id": _id}
elif topic == "ksus" and item:
if item == "clone":
_id = self.engine.clone(
......@@ -2024,7 +2024,7 @@ class Server(object):
cherrypy.request.headers,
)
self._set_location_header(main_topic, version, topic, _id)
outdata = {"id": _id}
outdata = {"_id": _id, "id": _id}
if item == "move":
op_id = self.engine.move_ksu(
engine_session, engine_topic, _id, indata, kwargs
......@@ -2055,7 +2055,7 @@ class Server(object):
cherrypy.request.headers,
)
self._set_location_header(main_topic, version, topic, _id)
outdata = {"id": _id}
outdata = {"_id": _id, "id": _id}
if op_id:
outdata["op_id"] = op_id
cherrypy.response.status = HTTPStatus.ACCEPTED.value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment