Commit 87410c51 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

slapos_jio_api_style: Add bang to Compute Node

parent fd5613b6
...@@ -134,6 +134,11 @@ ...@@ -134,6 +134,11 @@
"type": "string",\n "type": "string",\n
"description": "Unique Id of the object. It is not editable."\n "description": "Unique Id of the object. It is not editable."\n
},\n },\n
"bang_status_message": {\n
"title": "Bang Message",\n
"description": "It trigger a Bang on the Compute Node and will force reprocessing og all hosted instances. Message Used to inform master with readable text.",\n
"type": "string"\n
},\n
"portal_type": {\n "portal_type": {\n
"title": "Portal Type",\n "title": "Portal Type",\n
"const": "Compute Node",\n "const": "Compute Node",\n
......
...@@ -42,7 +42,8 @@ def compareAndUpdateAddressList(partition, partition_ip_list): ...@@ -42,7 +42,8 @@ def compareAndUpdateAddressList(partition, partition_ip_list):
if to_delete_ip_id_list: if to_delete_ip_id_list:
partition.deleteContent(to_delete_ip_id_list) partition.deleteContent(to_delete_ip_id_list)
if "bang_status_message" in data_dict:
context.reportComputeNodeBang(comment=data_dict["bang_status_message"])
# Getting existing partitions # Getting existing partitions
existing_partition_dict = {} existing_partition_dict = {}
...@@ -51,7 +52,7 @@ for c in context.contentValues(portal_type="Compute Partition"): ...@@ -51,7 +52,7 @@ for c in context.contentValues(portal_type="Compute Partition"):
# update compute_node data # update compute_node data
edit_kw = {} edit_kw = {}
quantity = len(data_dict['compute_partition_list']) quantity = len(data_dict.get('compute_partition_list', []))
if context.getQuantity() != quantity: if context.getQuantity() != quantity:
edit_kw['quantity'] = quantity edit_kw['quantity'] = quantity
...@@ -59,7 +60,7 @@ if edit_kw: ...@@ -59,7 +60,7 @@ if edit_kw:
context.edit(**edit_kw) context.edit(**edit_kw)
expected_partition_dict = {} expected_partition_dict = {}
for send_partition in data_dict['compute_partition_list']: for send_partition in data_dict.get('compute_partition_list', []):
partition = existing_partition_dict.get(send_partition['partition_id'], None) partition = existing_partition_dict.get(send_partition['partition_id'], None)
expected_partition_dict[send_partition['partition_id']] = True expected_partition_dict[send_partition['partition_id']] = True
if partition is None: if partition is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment