Commit f55a8d27 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Cédric Le Ninivin

slapos_cloud: Improve Software Instance as JSON Text

parent 5cb264e5
...@@ -326,7 +326,6 @@ class SoftwareInstance(Item, JSONType): ...@@ -326,7 +326,6 @@ class SoftwareInstance(Item, JSONType):
state = 'destroyed' state = 'destroyed'
else: else:
raise ValueError("Unknown slap state : %s" % requested_state) raise ValueError("Unknown slap state : %s" % requested_state)
# software instance has to define an xml parameter # software instance has to define an xml parameter
result = { result = {
"$schema": self.getPortalObject().portal_types.restrictedTraverse(self.getPortalType()).absolute_url() "$schema": self.getPortalObject().portal_types.restrictedTraverse(self.getPortalType()).absolute_url()
...@@ -338,6 +337,10 @@ class SoftwareInstance(Item, JSONType): ...@@ -338,6 +337,10 @@ class SoftwareInstance(Item, JSONType):
"node": self.getSlaXmlAsDict(), "node": self.getSlaXmlAsDict(),
"state": state, "state": state,
"id": self.getRelativeUrl(), "id": self.getRelativeUrl(),
"software_release_uri": self.getUrlString(),
"software_type": self.getSourceReference().decode("UTF-8"),
"compute_node_id": parameter_dict.get("slap_computer_id"),
"compute_partition_id": parameter_dict.get("slap_computer_partition_id"),
} }
result.update(parameter_dict) result.update(parameter_dict)
return json.dumps(result, indent=2) return json.dumps(result, indent=2)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>SoftwareInstance</string> </value> <value> <string>SoftwareInstance</string> </value>
...@@ -49,13 +55,28 @@ ...@@ -49,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -68,7 +89,7 @@ ...@@ -68,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,7 +98,7 @@ ...@@ -77,7 +98,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -85,33 +85,52 @@ ...@@ -85,33 +85,52 @@
},\n },\n
"software_release_uri": {\n "software_release_uri": {\n
"title": "Software Release URI",\n "title": "Software Release URI",\n
"type": "string"\n "type": "string",\n
"description": "URL of the software release used by the software instance"\n
},\n },\n
"software_type": {\n "software_type": {\n
"title": "Software Type",\n "title": "Software Type",\n
"type": "string",\n "type": "string",\n
"description": "Software type to be requested"\n "description": "Software type of the instance, it define the type of the instance according to the software release"\n
},\n },\n
"state": {\n "state": {\n
"title": "Requested State",\n "title": "Requested State",\n
"type": "string",\n "type": "string",\n
"enum": ["started", "stopped", "destroyed"],\n "enum": ["started", "stopped", "destroyed"],\n
"description": "State of the requested instance"\n "description": "State of the requested instance. It is functionnal when started. In stopped state, all services are stopped. If destroyed, it will remove the instance."\n
},\n },\n
"connection_parameters": {\n "connection_parameters": {\n
"title": "Connections Parameters",\n "title": "Connections Parameters",\n
"type": "object",\n "type": "object",\n
"description": "List of parameters provided by the instance to access it.",\n
"additionalProperties": { "type": "string" }\n "additionalProperties": { "type": "string" }\n
},\n },\n
"parameters": {\n "parameters": {\n
"title": "Instance Parameters",\n "title": "Instance Parameters",\n
"type": "object",\n "type": "object",\n
"description": "Parameters provided to the instance when requested to configure it.",\n
"additionalProperties": { "type": "string" }\n "additionalProperties": { "type": "string" }\n
},\n },\n
"shared": {\n "shared": {\n
"title": "Shared Instance",\n "title": "Shared Instance",\n
"type": "boolean",\n "type": "boolean",\n
"description": "Ask for a Shared Instance"\n "description": "This instance is Shared Instance hosted on another instance. It doesn\'t use a computer partition."\n
},\n
"root_instante_title": {\n
"title": "Root Instance Title",\n
"type": "string",\n
"description": "Title of the Instance at the root of the instance tree. This is the title of the instance that has been requested by the user."\n
},\n
"ip_list": {\n
"title": "IP List",\n
"type": "array",\n
"descritpion": "List of IPs usable by the Software Instance on the partition",\n
"items": {\n
"type": "array",\n
"items": {\n
"type": "string"\n
}\n
}\n
},\n },\n
"sla_parameters": {\n "sla_parameters": {\n
"title": "Target Node Selection Parameters",\n "title": "Target Node Selection Parameters",\n
......
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