Commit 25224cae authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

2011-02-07 Kazuhiko

* remove set and upgrade product_path, that should be handled by instance creation in buildout.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43115 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b3319441
......@@ -119,58 +119,3 @@ def _getZopeConfigurationFile(relative_path="", mode="r"):
raise IOError, 'The file: %s does not exist.' % file_path
return open(file_path, mode)
# XXX This method is a copy and paste of IntrospectionTool.setProductPath
# This should be kept until versions lower than 5.4.3 still supported.
def setProductPath(self, relative_path):
"""
Set the value of SOFTWARE_HOME for zopectl startup script
or from zope.conf (whichever is most relevant)
Rationale: multiple versions of Products can be present
on the same system
relative_path is usually defined by a number of release
(ex. 5.4.2)
WARNING: the list of possible path should be protected
if possible (ex. /etc/erp5/product)
"""
# XXX Local to remove "self"
config = _loadExternalConfig()
allowed_path_list = config.get("main", "products").split("\n")
base_product_path_list = config.get("base", "base_product_path").split("\n")
if len(base_product_path_list) == 0:
raise Unauthorized(
"base_product_path_list is not defined into configuration.")
base_product_path = base_product_path_list[0]
path = base_product_path + relative_path
if path not in allowed_path_list:
raise Unauthorized(
"You are setting one Unauthorized path as Product Path (%s)." \
% (path))
# XXX Local to remove "self"
config_file = _getZopeConfigurationFile("etc/zope.conf")
new_file_list = []
ignore_list = ['parts/cmf15', "parts/products-deps" , "parts/products-other"]
for line in config_file:
new_line = line
#if line.strip(" ").startswith("products %s" % (base_product_path)):
if line.strip(" ").startswith("products"):
# Only comment the line, so it can easily reverted
if len([i for i in ignore_list if i in line]) == 0:
new_line = "#%s" % (line)
new_file_list.append(new_line)
new_file_list.append("products %s\n" % (path))
config_file.close()
# reopen file for write
# XXX Local to remove "self"
config_file = _getZopeConfigurationFile("etc/zope.conf", "w")
config_file.write("".join(new_file_list))
config_file.close()
return
......@@ -47,27 +47,6 @@ def ERP5Site_editERP5SiteProperty(self, prop, value):
method(prop, value)
return True
def ERP5Site_verifyProductPathUpgrade(self):
"""
Due activities concurrency, it is needed that the upgrade process
only proceed after restart be sucessfully done.
This script make sure that the process will wait for the
Prodcuts be upgraded to proceed.
This method is not elegant solution but it is essential part
between restart zope and update Activities.
"""
# check if the products are already updated.
if len(self.ERP5Site_upgradeProductPath()) > 0:
# Wait at least 20 seconds before try again
# This will prevent the activities be invoked
# too early.
sleep(20)
# Force failure for restart the activity
raise
return
def ERP5Site_restartZopeInstance(self):
"""
Zope must be restart after update the Products or Software
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># Update activity tables before upgrade upgrade products.\n
# XXX The followed scripts could be even more generic.\n
\n
column_list = [i[0] for i in context.portal_activities.ActivityTool_showMessageQueueTableColumns()]\n
if \'group_method_id\' not in column_list:\n
context.portal_activities.ActivityTool_upgradeMessageQueueTable()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_beforeUpgradeProductPath</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>setProductPath</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderCompatibility</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_setProductPath</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Method not present after 5.4.3 into portal Introspections</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
Update Product Path in zope.conf\n
\n
ERP5Site_getSystemSignatureDict and ERP5Site_setProductPath are \n
used to keep backward compatibility with newer implementations.\n
"""\n
\n
signature = context.ERP5Site_getUpgraderSignature()\n
try:\n
product_version = context.portal_introspections.getSystemSignatureDict()[\'erp5\']\n
except:\n
# Try to use externals instead because portal_introspections is not available.\n
product_version = context.ERP5Site_getSystemSignatureDict()[\'erp5\']\n
\n
if product_version == signature["release"]:\n
return []\n
\n
if not upgrade:\n
return ["Upgrade required for Products. Current: %s , Expect %s" % (\n
product_version, signature["release"]) ]\n
\n
context.ERP5Site_beforeUpgradeProductPath()\n
\n
try:\n
context.portal_introspections.setProductPath(signature["release"])\n
except:\n
# Try to use externals instead because portal_introspections is not available.\n
context.ERP5Site_setProductPath(signature["release"])\n
\n
return ["Upgraded Product Path List to %s" % (signature["release"])]\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeProductPath</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_verifyProductPathUpgrade</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_verifyProductPathUpgrade</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -63,8 +63,6 @@ message_list.extend(context.ERP5Site_upgradePythonExecutable())\n
\n
message_list.extend(context.ERP5Site_upgradeSoftwareHome())\n
\n
message_list.extend(context.ERP5Site_upgradeProductPath())\n
\n
message_list.extend(context.ERP5Site_upgradeBusinessTemplateList())\n
\n
message_list.extend(context.ERP5Site_upgradeGlobalPropertyList())\n
......
2011-02-07 Kazuhiko
* remove set and upgrade product_path, that should be handled by instance creation in buildout.
2011-02-04 Kazuhiko
* remove system_upgrader and product_upgrader, that should be handled by instance creation in buildout.
2010-09-30 lucas
* Added message to be logged if during the upgrade of the Local Roles for security groups the Portal Type document does not exists.
......
566
\ No newline at end of file
567
\ No newline at end of file
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