Commit 7c9c2e1f authored by Rafael Monnerat's avatar Rafael Monnerat

Remove setSoftwareHome (commented)

parent 0e51f6d5
...@@ -296,45 +296,45 @@ class IntrospectionTool(LogMixin, BaseTool): ...@@ -296,45 +296,45 @@ class IntrospectionTool(LogMixin, BaseTool):
""" """
return getConfiguration().softwarehome return getConfiguration().softwarehome
security.declareProtected(Permissions.ManagePortal, 'setSoftwareHome') #security.declareProtected(Permissions.ManagePortal, 'setSoftwareHome')
def setSoftwareHome(self, relative_path): #def setSoftwareHome(self, relative_path):
""" # """
EXPERIMENTAL - DEVELOPMENT # EXPERIMENTAL - DEVELOPMENT
Set the value of SOFTWARE_HOME for zopectl startup script
or from zope.conf (whichever is most relevant)
Rationale: multiple versions of ERP5 / Zope can be present # Set the value of SOFTWARE_HOME for zopectl startup script
at the same time on the same system # or from zope.conf (whichever is most relevant)
WARNING: the list of possible path should be protected # Rationale: multiple versions of ERP5 / Zope can be present
if possible (ex. /etc/erp5/software_home) # at the same time on the same system
"""
config = self._loadExternalConfig()
allowed_path_list = config.get("main", "zopehome").split("\n")
base_zope_path = config.get("base", "base_zope_path").split("\n")
path = "%s/%s/lib/python" % (base_zope_path,relative_path)
if path not in allowed_path_list: # WARNING: the list of possible path should be protected
raise Unauthorized("You are setting one Unauthorized path as Zope Home.") # if possible (ex. /etc/erp5/software_home)
# """
# config = self._loadExternalConfig()
# allowed_path_list = config.get("main", "zopehome").split("\n")
# base_zope_path = config.get("base", "base_zope_path").split("\n")
# path = "%s/%s/lib/python" % (base_zope_path,relative_path)
#
# if path not in allowed_path_list:
# raise Unauthorized("You are setting one Unauthorized path as Zope Home.")
config_file = self._getZopeConfigurationFile("bin/zopectl") # config_file = self._getZopeConfigurationFile("bin/zopectl")
new_file_list = [] # new_file_list = []
for line in config_file: # for line in config_file:
if line.startswith("SOFTWARE_HOME="): # if line.startswith("SOFTWARE_HOME="):
# Only comment the line, so it can easily reverted # # Only comment the line, so it can easily reverted
new_file_list.append("#%s" % (line)) # new_file_list.append("#%s" % (line))
new_file_list.append('SOFTWARE_HOME="%s"\n' % (path)) # new_file_list.append('SOFTWARE_HOME="%s"\n' % (path))
else: # else:
new_file_list.append(line) # new_file_list.append(line)
config_file.close() # config_file.close()
# reopen file for write # # reopen file for write
config_file = self._getZopeConfigurationFile("bin/zopectl", "w") # config_file = self._getZopeConfigurationFile("bin/zopectl", "w")
config_file.write("".join(new_file_list)) # config_file.write("".join(new_file_list))
config_file.close() # config_file.close()
return # return
security.declareProtected(Permissions.ManagePortal, 'getPythonExecutable') security.declareProtected(Permissions.ManagePortal, 'getPythonExecutable')
def getPythonExecutable(self): def getPythonExecutable(self):
......
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