Commit f6f2ea94 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Let the workflow transition (bang) update the error status

parent bb983933
......@@ -11,3 +11,5 @@ for compute_partition in [x for x in compute_node.contentValues(portal_type='Com
relative_url=instance.getRelativeUrl(),
reference=instance.getReference(),
comment=state_change.kwargs.get('comment', ''))
compute_node.setErrorStatus('bang')
......@@ -52,6 +52,12 @@
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>script_ComputeNode_reportBang</string> </value>
......
......@@ -3,6 +3,9 @@ instance = state_change['object']
assert instance.getPortalType() in ["Slave Instance", "Software Instance"]
instance.edit(bang_timestamp=int(DateTime()))
key = "%s_bangstamp" % instance.getReference()
instance.setLastData(key, str(int(instance.getModificationDate())))
comment = state_change.kwargs['comment'] # comment is required to pass the transition
if state_change.kwargs['bang_tree']:
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
......
......@@ -60,6 +60,12 @@
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>script_RequestedInstance_bangInstanceTree</string> </value>
......
......@@ -605,7 +605,6 @@ class SlapTool(BaseTool):
Fire up bung on Compute Node
"""
compute_node = self._getComputeNodeDocument(compute_node_id)
compute_node.setErrorStatus('bang')
return compute_node.reportComputeNodeBang(comment=message)
security.declareProtected(Permissions.AccessContentsInformation,
......@@ -883,7 +882,6 @@ class SlapTool(BaseTool):
if (software_instance.getLastData(key) != timestamp):
software_instance.bang(bang_tree=True, comment=message)
software_instance.setLastData(key, str(int(software_instance.getModificationDate())))
return "OK"
@convertToREST
......
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