Commit 9024402b authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Extent SoftwareInstance_hasReportedError to make it more flexible

Allow it report the message and creation date, which can be usable on other contexts.
parent 81c4585a
...@@ -12,15 +12,19 @@ if context.getAggregateValue(portal_type="Computer Partition") is not None: ...@@ -12,15 +12,19 @@ if context.getAggregateValue(portal_type="Computer Partition") is not None:
d = json.loads(d) d = json.loads(d)
result = d['text'] result = d['text']
last_contact = DateTime(d.get('created_at'))
# Optimise by checking memcache information first. # Optimise by checking memcache information first.
if result.startswith('#error '): if result.startswith('#error '):
if include_created_at:
return result, last_contact
return result return result
#last_contact = DateTime(d.get('created_at'))
# XXX time limit of 48 hours for run at least once. # XXX time limit of 48 hours for run at least once.
if include_message and include_created_at:
return result, last_contact
if include_message: if include_message and not include_created_at:
return result return result
return None return None
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>include_message=False</string> </value> <value> <string>include_message=False, include_created_at=False</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
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