mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -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
|
||||
instance or role.
|
||||
"""
|
||||
@cached_property
|
||||
def me(self):
|
||||
"""Return the currently active instance."""
|
||||
return self.get(uuid=settings.SYSTEM_UUID)
|
||||
|
||||
@cached_property
|
||||
def my_role(self):
|
||||
"""Return the role of the currently active instance, as a string
|
||||
('primary' or 'secondary').
|
||||
"""
|
||||
if self.me.primary:
|
||||
if self.me().primary:
|
||||
return 'primary'
|
||||
return 'secondary'
|
||||
|
||||
Reference in New Issue
Block a user