Commit 3b117a2a authored by Rafael Monnerat's avatar Rafael Monnerat

Added Upgrader script to enable or disabled alarms after upgrade.

Fix typo.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39115 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 66424eff
......@@ -91,6 +91,9 @@ if len(context.ERP5Site_upgradeSQLCatalogFilter()) > 0: \n
if len(context.ERP5Site_upgradeSQLCatalog()) > 0: \n
return True\n
\n
if len(context.ERP5Site_upgradeAlarmToolConfiguration()) > 0:\n
return True\n
\n
# (rafael) Maybe this is dangerous, enable it when this\n
# is appropriated tested.\n
#if len(context.ERP5Site_upgradeMySQLCharset()) > 0: \n
......
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
......@@ -104,6 +101,9 @@ message_list.extend(context.ERP5Site_upgradeSQLCatalogFilter(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeObjectClass(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeAlarmToolConfiguration(upgrade=1))\n
\n
\n
# Verify if there was any change previously and \n
if len(message_list) > 0:\n
message_list.extend(context.ERP5Site_upgradeSQLCatalog(upgrade=1))\n
......
......@@ -525,7 +525,7 @@ ERP5_SITE_PROPERTY_DICT = {}\n
# Define alarm configuration list, which alarm will be enabled or\n
# disabled.\n
# Usage (("alarm_id", True or False ),) \n
ALARM_CONFIGURATION_list = ()\n
ALARM_TOOL_CONFIGURATION_LIST = ()\n
\n
\n
#\n
......@@ -591,7 +591,7 @@ signature_dict = {\n
# Define if the site will be recatalogued or not after finish upgrade.\n
, \'recatalog\' : RECATALOG\n
# Define which alarm should be enabled or disabled.\n
, \'alarm_configuration_list\' : ALARM_CONFIGURATION_DICT\n
, \'alarm_tool_configuration_list\' : ALARM_TOOL_CONFIGURATION_LIST\n
}\n
\n
if item is not None:\n
......@@ -661,10 +661,9 @@ else:\n
<string>CATALOG_FILTER_DICT</string>
<string>INTEGRITY_VERIFICATION_SCRIPT_ID_LIST</string>
<string>ERP5_SITE_PROPERTY_DICT</string>
<string>ALARM_CONFIGURATION_list</string>
<string>ALARM_TOOL_CONFIGURATION_LIST</string>
<string>UPGRADE_OBJECT_CLASS_LIST</string>
<string>RECATALOG</string>
<string>ALARM_CONFIGURATION_DICT</string>
<string>signature_dict</string>
</tuple>
</value>
......
<?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
"""\n
message_list = []\n
portal_alarms = context.portal_alarms\n
alarm_tool_configuration_list = context.ERP5Site_getUpgraderSignature("alarm_tool_configuration_list")\n
if alarm_tool_configuration_list is None:\n
return message_list\n
\n
for alarm_id, is_enabled in alarm_tool_configuration_list: \n
obj = getattr(portal_alarms, alarm_id, None)\n
if obj is not None and int(obj.getEnabled()) != int(is_enabled):\n
message = "Upgrade is required for Alarm %s, enabled = %s (expected %s)" % \\\n
(alarm_id, obj.getEnabled(),is_enabled )\n
if int(upgrade) == 1:\n
obj.setEnabled(int(is_enabled))\n
message = "[ UPDATED ] " + message\n
message_list.append(message)\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>upgrade</string>
<string>message_list</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_alarms</string>
<string>alarm_tool_configuration_list</string>
<string>None</string>
<string>_getiter_</string>
<string>alarm_id</string>
<string>is_enabled</string>
<string>getattr</string>
<string>obj</string>
<string>int</string>
<string>message</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeAlarmToolConfiguration</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
539
\ No newline at end of file
540
\ 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