Commit 36538eb0 by Őry Máté

vm: fix boolean comparsions

parent f8bb2ede
...@@ -29,7 +29,7 @@ def node_available(function): ...@@ -29,7 +29,7 @@ def node_available(function):
"""Decorate methods to ignore disabled Nodes. """Decorate methods to ignore disabled Nodes.
""" """
def decorate(self, *args, **kwargs): def decorate(self, *args, **kwargs):
if self.enabled is True and self.online is True: if self.enabled and self.online:
return function(self, *args, **kwargs) return function(self, *args, **kwargs)
else: else:
return None return None
...@@ -106,7 +106,7 @@ class Node(TimeStampedModel): ...@@ -106,7 +106,7 @@ class Node(TimeStampedModel):
def disable(self, user=None): def disable(self, user=None):
''' Disable the node.''' ''' Disable the node.'''
if self.enabled is True: if self.enabled:
with node_activity(code_suffix='disable', node=self, user=user): with node_activity(code_suffix='disable', node=self, user=user):
self.enabled = False self.enabled = False
self.save() self.save()
...@@ -148,7 +148,7 @@ class Node(TimeStampedModel): ...@@ -148,7 +148,7 @@ class Node(TimeStampedModel):
self.node_online() self.node_online()
return self.host.hostname + "." + queue_id return self.host.hostname + "." + queue_id
else: else:
if self.enabled is True: if self.enabled:
self.node_offline() self.node_offline()
raise WorkerNotFound() raise WorkerNotFound()
......
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