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

slapos_cloud: Fixes to Software Instance Document and ip list is empty for shared instances

* getSlapTimeStamp use unrestricted method
* use sort by jip_api_revision and not slap_date when sorting shared instances to calculate timestamp
* ip list is empty for shared instances
parent 32a6b219
......@@ -181,6 +181,10 @@ class SoftwareInstance(Item, JSONType):
return software_instance_dict
def getSlapTimestamp(self):
return self._getSlapTimestamp()
@UnrestrictedMethod
def _getSlapTimestamp(self):
compute_partition = self.getAggregateValue(portal_type="Compute Partition")
if compute_partition is None:
return int(self.getModificationDate())
......@@ -198,13 +202,16 @@ class SoftwareInstance(Item, JSONType):
default_aggregate_uid=compute_partition.getUid(),
portal_type='Slave Instance',
validation_state="validated",
sort_on=(("slap_date", "DESC"),),
select_list=("slap_date",),
sort_on=(("jio_api_revision.revision", "DESC"),),
select_list=('jio_api_revision.revision',),
limit=1,
**{"slapos_item.slap_state": "start_requested"}
)
if shared_instance_sql_list:
most_recent_hosted_instance_timestamp = int(shared_instance_sql_list[0].slap_date)
shared_instance = shared_instance_sql_list[0].getObject()
most_recent_hosted_instance_timestamp = int(
shared_instance.getBangTimestamp(int(shared_instance.getModificationDate()))
)
if (most_recent_hosted_instance_timestamp > timestamp):
timestamp = most_recent_hosted_instance_timestamp
......@@ -222,6 +229,7 @@ class SoftwareInstance(Item, JSONType):
ip_list = []
full_ip_list = []
if (self.getPortalType() == "Software Instance"):
for internet_protocol_address in compute_partition.contentValues(portal_type='Internet Protocol Address'):
# XXX - There is new values, and we must keep compatibility
address_tuple = (
......
......@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SoftwareInstance</string> </value>
......@@ -55,28 +49,13 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -89,7 +68,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
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