summaryrefslogtreecommitdiff
path: root/opendc/api/v1/paths
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-26 17:10:06 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-26 17:10:06 +0200
commit44f0bd378763f4c481fb8a87847ca84469b35a67 (patch)
treed9517715e54b635ebd068ab3041afc60c2b30c62 /opendc/api/v1/paths
parenta1589e75358558eada7ffc2efc7e3fa7160d233e (diff)
Copy over topology_ids on branch
Diffstat (limited to 'opendc/api/v1/paths')
-rw-r--r--opendc/api/v1/paths/pathId/branches/endpoint.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/opendc/api/v1/paths/pathId/branches/endpoint.py b/opendc/api/v1/paths/pathId/branches/endpoint.py
index 1f330472..13638ffa 100644
--- a/opendc/api/v1/paths/pathId/branches/endpoint.py
+++ b/opendc/api/v1/paths/pathId/branches/endpoint.py
@@ -111,6 +111,9 @@ def POST(request):
old_room.datacenter_id = path_parameters['datacenterId']
+ if old_room.topology_id is None:
+ old_room.topology_id = old_room.id
+
message = old_room.generate_api_call(path_parameters, request.token)
response = Request(message).process()
@@ -124,6 +127,9 @@ def POST(request):
old_tile.room_id = path_parameters['roomId']
+ if old_tile.topology_id is None:
+ old_tile.topology_id = old_tile.id
+
message = old_tile.generate_api_call(path_parameters, request.token)
response = Request(message).process()
@@ -137,6 +143,9 @@ def POST(request):
old_rack = Rack.query('id', old_objects[0].id)[0]
+ if old_rack.topology_id is None:
+ old_rack.topology_id = old_rack.id
+
message = old_rack.generate_api_call(path_parameters, request.token)
response = Request(message).process()
@@ -150,6 +159,9 @@ def POST(request):
old_machine.read()
old_machine.rack_id = path_parameters['rackId']
+ if old_machine.topology_id is None:
+ old_machine.topology_id = old_machine.id
+
message = old_machine.generate_api_call(path_parameters, request.token)
response = Request(message).process()