mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Thinking better of making the manager methods properties.
This commit is contained in:
@@ -12,16 +12,14 @@ class InstanceManager(models.Manager):
|
|||||||
Provides "table-level" methods including getting the currently active
|
Provides "table-level" methods including getting the currently active
|
||||||
instance or role.
|
instance or role.
|
||||||
"""
|
"""
|
||||||
@cached_property
|
|
||||||
def me(self):
|
def me(self):
|
||||||
"""Return the currently active instance."""
|
"""Return the currently active instance."""
|
||||||
return self.get(uuid=settings.SYSTEM_UUID)
|
return self.get(uuid=settings.SYSTEM_UUID)
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def my_role(self):
|
def my_role(self):
|
||||||
"""Return the role of the currently active instance, as a string
|
"""Return the role of the currently active instance, as a string
|
||||||
('primary' or 'secondary').
|
('primary' or 'secondary').
|
||||||
"""
|
"""
|
||||||
if self.me.primary:
|
if self.me().primary:
|
||||||
return 'primary'
|
return 'primary'
|
||||||
return 'secondary'
|
return 'secondary'
|
||||||
|
|||||||
Reference in New Issue
Block a user