Commit 0eb1fbe1 by Bach Dániel

Merge remote-tracking branch 'origin/master' into feature-fix-acls

parents 79a46294 9d49beaf
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{% if op.show_in_toolbar %} {% if op.show_in_toolbar %}
{% if op.disabled %} {% if op.disabled %}
<span class="operation operation-{{op.op}} btn btn-{{op.effect}} disabled btn-xs"> <span class="operation operation-{{op.op}} btn btn-default disabled btn-xs">
{% else %} {% else %}
<a href="{{op.get_url}}" class="operation operation-{{op.op}} btn <a href="{{op.get_url}}" class="operation operation-{{op.op}} btn
btn-{{op.effect}} btn-xs" title="{{op.name}}: {{op.description}}"> btn-{{op.effect}} btn-xs" title="{{op.name}}: {{op.description}}">
......
...@@ -148,10 +148,14 @@ class Node(OperatedMixin, TimeStampedModel): ...@@ -148,10 +148,14 @@ class Node(OperatedMixin, TimeStampedModel):
self.enabled = False self.enabled = False
self.save() self.save()
def enable(self, user=None): def enable(self, user=None, base_activity=None):
''' Enable the node. ''' ''' Enable the node. '''
if self.enabled is not True: if self.enabled is not True:
with node_activity(code_suffix='enable', node=self, user=user): if base_activity:
act_ctx = base_activity.sub_activity('enable')
else:
act_ctx = node_activity('enable', node=self, user=user)
with act_ctx:
self.enabled = True self.enabled = True
self.save() self.save()
self.get_info(invalidate_cache=True) self.get_info(invalidate_cache=True)
......
...@@ -649,7 +649,14 @@ class FlushOperation(NodeOperation): ...@@ -649,7 +649,14 @@ class FlushOperation(NodeOperation):
description = _("Disable node and move all instances to other ones.") description = _("Disable node and move all instances to other ones.")
required_perms = () required_perms = ()
def on_abort(self, activity, error):
from manager.scheduler import TraitsUnsatisfiableException
if isinstance(error, TraitsUnsatisfiableException):
if self.node_enabled:
self.node.enable(activity.user, activity)
def _operation(self, activity, user): def _operation(self, activity, user):
self.node_enabled = self.node.enabled
self.node.disable(user, activity) self.node.disable(user, activity)
for i in self.node.instance_set.all(): for i in self.node.instance_set.all():
with activity.sub_activity('migrate_instance_%d' % i.pk): with activity.sub_activity('migrate_instance_%d' % i.pk):
......
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