Add execution node information

This commit is contained in:
Matthew Jones
2016-10-20 13:24:12 -04:00
parent e8669b0cbf
commit b906469b40
3 changed files with 11 additions and 9 deletions

View File

@@ -31,13 +31,10 @@ class InstanceManager(models.Manager):
hostname='localhost',
uuid='00000000-0000-0000-0000-000000000000')
# If we can determine the instance we are on then return
# that, otherwise None which would be the standalone
# case
# TODO: Replace, this doesn't work if the hostname
# is different from the Instance.name
# node = self.filter(hostname=socket.gethostname())
return self.all()[0]
node = self.filter(hostname=settings.CLUSTER_HOST_ID)
if node.exists():
return node[0]
raise RuntimeError("No instance found with the current cluster host id")
def my_role(self):
# NOTE: TODO: Likely to repurpose this once standalone ramparts are a thing