Commit 3b9457cc by Őry Máté

vm: allow renotifying if last action not a notification

fixes #177
parent 2a386b8e
...@@ -648,11 +648,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -648,11 +648,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
raise Node.DoesNotExist() raise Node.DoesNotExist()
def _is_notified_about_expiration(self): def _is_notified_about_expiration(self):
renews = self.activity_log.filter(activity_code__endswith='renew') last_activity = self.activity_log.latest('pk')
cond = {'activity_code__endswith': 'notification_about_expiration'} return (last_activity.activity_code ==
if len(renews) > 0: 'vm.Instance.notification_about_expiration')
cond['finished__gt'] = renews[0].started
return self.activity_log.filter(**cond).exists()
def notify_owners_about_expiration(self, again=False): def notify_owners_about_expiration(self, again=False):
"""Notify owners about vm expiring soon if they aren't already. """Notify owners about vm expiring soon if they aren't already.
......
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 sign in to comment