Commit 88bd0cb3 authored by Xavier Thompson's avatar Xavier Thompson

slapgrid: Map instances to their installed python

parent f3699528
...@@ -472,6 +472,8 @@ class Partition(object): ...@@ -472,6 +472,8 @@ class Partition(object):
self.instance_min_free_space = instance_min_free_space self.instance_min_free_space = instance_min_free_space
self.instance_python = self.getInstalledPythonExecutable()
def check_free_space(self): def check_free_space(self):
required = self.instance_min_free_space or 0 required = self.instance_min_free_space or 0
...@@ -705,6 +707,7 @@ class Partition(object): ...@@ -705,6 +707,7 @@ class Partition(object):
debug=self.buildout_debug) debug=self.buildout_debug)
self.generateSupervisorConfigurationFile() self.generateSupervisorConfigurationFile()
self.createRetentionLockDelay() self.createRetentionLockDelay()
self.instance_python = self.getInstalledPythonExecutable()
def generateSupervisorConfiguration(self): def generateSupervisorConfiguration(self):
""" """
...@@ -1043,3 +1046,15 @@ class Partition(object): ...@@ -1043,3 +1046,15 @@ class Partition(object):
return float(date_file_path.read()) return float(date_file_path.read())
else: else:
return None return None
def getInstalledPythonExecutable(self):
"""
Return the path of the python executable installed for the SR of this instance.
"""
try:
with open(os.path.join(self.software_path, 'bin', 'buildout')) as f:
shebang = f.readline()
except OSError:
return
if shebang.startswith('#!'):
return shebang[2:].split(None, 1)[0]
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 to comment