Commit d1c03593 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Bang after request destroy, to ensure the whole Hosting Subscription is processed

parent fa0ebacf
...@@ -62,7 +62,7 @@ def SoftwareInstance_renameAndRequestDestroy(self, REQUEST=None): ...@@ -62,7 +62,7 @@ def SoftwareInstance_renameAndRequestDestroy(self, REQUEST=None):
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
assert self.getPortalType() in ["Software Instance", "Slave Instance"] assert self.getPortalType() in ["Software Instance", "Slave Instance"]
title = self.getTitle() title = self.getTitle()
new_title = title + "_renamed_and_destroyed_%s" % (DateTime().strftime("%Y%m%d_%H%M%S")) new_title = title + "_renamed_and_destroyed_%s" % (DateTime().strftime("%Y%m%d_%H%M%S"))
self.rename(new_name=new_title, self.rename(new_name=new_title,
...@@ -85,4 +85,12 @@ def SoftwareInstance_renameAndRequestDestroy(self, REQUEST=None): ...@@ -85,4 +85,12 @@ def SoftwareInstance_renameAndRequestDestroy(self, REQUEST=None):
for name in [title, new_title]: for name in [title, new_title]:
# reset request cache # reset request cache
key = '_'.join([hosting_subscription, name]) key = '_'.join([hosting_subscription, name])
self.getPortalObject().portal_slap._storeLastData(key, {}) self.getPortalObject().portal_slap._storeLastData(key, {})
\ No newline at end of file
# Them call bang to enforce tree to reprocess.
timestamp = str(int(self.getModificationDate()))
key = "%s_bangstamp" % self.getReference()
if (self.portal_slap._getLastData(key) != timestamp):
self.bang(bang_tree=True, comment="Instance was destroyed.")
self.portal_slap._storeLastData(key, str(int(self.getModificationDate())))
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
<none/>
</tuple> </tuple>
</pickle> </pickle>
</record> </record>
......
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