Commit a938e8f3 authored by Rafael Monnerat's avatar Rafael Monnerat

Merge branch 'master' into operation-control

parents 4bb8f7f0 cf74f646
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>use/crm/upgrade_decision</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Services used to classify support requests</string> </value>
</item>
<item>
<key> <string>effective_date</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>upgrade_decision</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Upgrade Decision</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
96
\ No newline at end of file
97
\ No newline at end of file
......@@ -181,6 +181,7 @@ active_process.postResult(active_result)
'task_module',
'task_report_module',
'transformation_module',
'upgrade_decision_module',
'web_page_module',
'web_site_module',
'workflow_module',
......
......@@ -60,17 +60,11 @@ computer_reference = computer.getReference()\n
if allocation_scope not in [\'open/public\', \'open/friend\']:\n
return\n
\n
is_service_provider = False\n
person = computer.getSourceAdministrationValue(portal_type="Person")\n
if not person:\n
return\n
\n
for assignment in person.contentValues(portal_type="Assignment"):\n
if assignment.getRole() == \'service_provider\':\n
is_service_provider = True\n
break\n
\n
if not is_service_provider:\n
if not person.Person_isServiceProvider():\n
#Turn this computer allocation scope to \'open/personal\'\n
edit_kw = {\n
\'allocation_scope\': \'open/personal\',\n
......
<?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>if \'service_provider\' in context.getRoleList():\n
return True\n
\n
for assignment in context.contentValues(portal_type="Assignment"):\n
if assignment.getRole() == \'service_provider\':\n
return True\n
\n
return False\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_isServiceProvider</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
47
\ No newline at end of file
49
\ No newline at end of file
......@@ -8,3 +8,4 @@ service_module/slapos_crm_stop_acknowledgement
service_module/slapos_crm_delete_acknowledgement
service_module/slapos_crm_delete_reminder
service_module/slapos_crm_monitoring
service_module/slapos_crm_upgrade
\ No newline at end of file
......@@ -8,6 +8,7 @@ service_module/slapos_crm_stop_acknowledgement
service_module/slapos_crm_delete_acknowledgement
service_module/slapos_crm_delete_reminder
service_module/slapos_crm_monitoring
service_module/slapos_crm_upgrade
support_request_module/slapos_crm_support_request_template
regularisation_request_module/slapos_crm_regularisation_request_template
event_module/slapos_crm_web_message_template
\ No newline at end of file
......@@ -26,5 +26,6 @@ service_module/slapos_crm_monitoring
service_module/slapos_crm_spam
service_module/slapos_crm_stop_acknowledgement
service_module/slapos_crm_stop_reminder
service_module/slapos_crm_upgrade
support_request_module/slapos_crm_support_request_template
support_request_module/slapos_crm_support_request_template_for_monitoring
\ No newline at end of file
......@@ -57,6 +57,6 @@
</chain>
<chain>
<type>Upgrade Decision</type>
<workflow>local_permission_slapos_interation_workflow</workflow>
<workflow>local_permission_slapos_interaction_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
......@@ -113,6 +113,7 @@ custom
slapos_upgrader
vifib_hosting
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -219,6 +220,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -321,6 +323,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -424,6 +427,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -524,6 +528,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -625,6 +630,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -725,6 +731,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -825,6 +832,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -925,6 +933,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......@@ -1027,6 +1036,7 @@ zpt_generic
custom
slapos_upgrader
slapos_contract
slapos_crm_monitoring
slapos_accounting
slapos_administration
slapos_cache
......
175
\ No newline at end of file
177
\ No newline at end of file
......@@ -12,4 +12,4 @@ Sale Packing List | local_permission_slapos_interaction_workflow
Slave Instance | local_permission_slapos_interaction_workflow
Software Installation | local_permission_slapos_interaction_workflow
Software Instance | local_permission_slapos_interaction_workflow
Upgrade Decision | local_permission_slapos_interation_workflow
\ No newline at end of file
Upgrade Decision | local_permission_slapos_interaction_workflow
\ No newline at end of file
......@@ -20,7 +20,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_hosting_subscription_create_upgrade_decision</string> </value>
<value> <string>slapos_pdm_hosting_subscription_create_upgrade_decision</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_processPlannedUpgradeDecision</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_pdm_upgrade_decision_process_planned</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_hour_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>3660.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Process Planned Upgrade Decisions</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -22,7 +22,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_upgrade_decision_process</string> </value>
<value> <string>slapos_pdm_upgrade_decision_process_started</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Upgrade Decision" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/slapos_crm_upgrade</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>UD-TEMPLATE</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>template_upgrade_decision</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Upgrade Decision</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>UD-TEMPLATE</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
......@@ -22,6 +22,12 @@
<key> <string>factory</string> </key>
<value> <string>addXMLObject</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Upgrade Decision</string> </value>
......
......@@ -5,6 +5,6 @@
</chain>
<chain>
<type>Upgrade Decision</type>
<workflow>upgrade_decision_workflow</workflow>
<workflow>edit_workflow, upgrade_decision_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
<?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>portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Upgrade Decision\',\n
simulation_state=\'planned\',\n
method_id=\'UpgradeDecision_notify\',\n
activate_kw={\'tag\': tag }\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_processPlannedUpgradeDecision</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 encoding="cdata"><![CDATA[
if reference is None:\n
raise ValueError("Missing Reference")\n
\n
portal = context.getPortalObject()\n
\n
upgrade_decision_list = portal.portal_catalog(\n
portal_type="Upgrade Decision", \n
reference=reference, limit=2)\n
\n
if not len(upgrade_decision_list):\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
\n
if len(upgrade_decision_list) > 1:\n
raise ValueError("Duplicated reference for %s. Please contact site administrators." % reference)\n
\n
upgrade_decision = upgrade_decision_list[0]\n
\n
if upgrade_decision.getSimulationState() in [\'draft\', \'planned\']:\n
message = "Sorry, the upgrade is not possible yet!"\n
\n
elif upgrade_decision.getSimulationState() in [\'cancelled\', \'rejected\']:\n
message = "Sorry, the upgrade is not possble, Upgrade Decision was Canceled or Rejected!"\n
\n
elif upgrade_decision.getSimulationState() == \'started\':\n
message = "This Upgrade Decision is already Started."\n
\n
elif upgrade_decision.getSimulationState() in [\'stopped\', \'delivered\']:\n
message = "This Upgrade Decision has been already processed."\n
\n
elif upgrade_decision.getSimulationState() == \'confirmed\':\n
message = "This Upgrade Decision has been requested, it will be processed in few minutes."\n
upgrade_decision.start()\n
\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString(message)})\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>reference</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_acceptUpgradeDecision</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 encoding="cdata"><![CDATA[
if reference is None:\n
raise ValueError("Missing Reference")\n
\n
portal = context.getPortalObject()\n
\n
upgrade_decision_list = portal.portal_catalog(\n
portal_type="Upgrade Decision", \n
reference=reference, limit=2)\n
\n
if len(upgrade_decision_list) == 0:\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
\n
if len(upgrade_decision_list) > 1:\n
raise ValueError("Duplicated reference for %s. Please contact site administrators." % reference)\n
\n
upgrade_decision = upgrade_decision_list[0]\n
\n
\n
if upgrade_decision.getSimulationState() in [\'cancelled\', \'rejected\']:\n
message = "Upgrade Decision is already Rejected!"\n
\n
elif upgrade_decision.getSimulationState() == \'started\':\n
message = "Sorry, This Upgrade Decision is already Started, you cannot reject it anymore."\n
\n
elif upgrade_decision.getSimulationState() in [\'stopped\', \'delivered\']:\n
message = "Sorry, this Upgrade Decision has been already processed."\n
\n
elif upgrade_decision.getSimulationState() in [\'confirmed\', \'draft\', \'planned\']:\n
message = "Thanks Upgrade Decision has been rejected Successfully (You cannot use it anymore)."\n
upgrade_decision.reject()\n
\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString(message)})\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>reference</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_rejectUpgradeDecision</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>return context.Ticket_getResourceItemList()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>UpgradeDecision_getResourceItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -68,7 +68,7 @@ context.setReference(reference)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
<?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>from DateTime import DateTime\n
\n
if context.getSimulationState() != \'planned\':\n
# XXX Don\'t notify the ones which are not planned.\n
return \n
\n
portal = context.getPortalObject()\n
\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
if not person:\n
raise ValueError("Inconsistent Upgrade Decision, No Destination Decision")\n
\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
software_product_title = software_release.getAggregateTitle(\n
portal_type="Software Product")\n
reference = context.getReference()\n
\n
mapping_dict = {\n
\'software_product_title\': software_product_title,\n
\'upgrade_accept_link\': \'Base_acceptUpgradeDecision?reference=%s\' % reference,\n
\'upgrade_reject_link\': \'Base_rejectUpgradeDecision?reference=%s\' % reference,\n
\'software_release_name\': software_release.getTitle(),\n
\'software_release_reference\': software_release.getReference(),\n
\'new_software_release_url\': software_release.getUrlString(),\n
\n
}\n
if hosting_subscription is not None:\n
notification_message_reference = \'slapos-upgrade-hosting-subscription.notification\'\n
title = "New Upgrade available for %s" % hosting_subscription.getTitle()\n
mapping_dict.update(**{\n
\'hosting_subscription_title\': hosting_subscription.getTitle(),\n
\'old_software_release_url\': hosting_subscription.getUrlString()})\n
\n
\n
elif computer is not None:\n
\n
notification_message_reference = \'slapos-upgrade-computer.notification\' \n
\n
title = "New Software available for Installation at %s" % computer.getTitle()\n
mapping_dict.update(**{\'computer_title\': computer.getTitle(),\n
\'computer_reference\': computer.getReference()})\n
\n
\n
if notification_message_reference is None:\n
raise ValueError("No Notification Message")\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=notification_message_reference)\n
\n
message = notification_message.asEntireHTML(\n
substitution_method_parameter_dict={\'mapping_dict\': mapping_dict})\n
\n
event = context.SupportRequest_trySendNotificationMessage(title,\n
message, person.getRelativeUrl())\n
\n
if event is not None:\n
context.confirm()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>UpgradeDecision_notify</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -13,11 +13,12 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
return "%sTEST" % self.portal.portal_ids.generateNewId(
id_group=('slapos_core_test'))
def _makeUpgradeDecision(self):
def _makeUpgradeDecision(self, confirm=True):
upgrade_decision = self.portal.\
upgrade_decision_module.newContent(
portal_type="Upgrade Decision",
title="TESTUPDE-%s" % self.new_id)
if confirm:
upgrade_decision.confirm()
return upgrade_decision
......@@ -36,13 +37,7 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
return computer
def _simulateUpgradeDecision_upgradeHostingSubscription(self, fake_return="True"):
self._simulateScript('UpgradeDecision_upgradeHostingSubscription', fake_return)
def _simulateUpgradeDecision_upgradeComputer(self, fake_return="True"):
self._simulateScript('UpgradeDecision_upgradeComputer', fake_return)
def _simulateScript(self, script_name, fake_return):
def _simulateScript(self, script_name, fake_return='True'):
if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom,
......@@ -55,12 +50,6 @@ return %s
""" % (script_name, fake_return ))
transaction.commit()
def _dropUpgradeDecision_upgradeHostingSubscription(self):
self._dropScript('UpgradeDecision_upgradeHostingSubscription')
def _dropUpgradeDecision_upgradeComputer(self):
self._dropScript('UpgradeDecision_upgradeComputer')
def _dropScript(self, script_name):
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
......@@ -71,67 +60,46 @@ return %s
upgrade_decision.start()
self.tic()
self._simulateUpgradeDecision_upgradeHostingSubscription()
self._simulateScript('UpgradeDecision_processUpgrade', 'True')
try:
self.portal.portal_alarms.slapos_upgrade_decision_process.activeSense()
self.portal.portal_alarms.slapos_pdm_upgrade_decision_process_started.activeSense()
self.tic()
finally:
self._dropUpgradeDecision_upgradeHostingSubscription()
self._dropScript('UpgradeDecision_processUpgrade')
self.assertEqual(
'Visited by UpgradeDecision_upgradeHostingSubscription',
'Visited by UpgradeDecision_processUpgrade',
upgrade_decision.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_upgrade_decision_process_computer(self):
upgrade_decision = self._makeUpgradeDecision()
upgrade_decision.start()
def test_alarm_upgrade_decision_process_planned(self):
upgrade_decision = self._makeUpgradeDecision(confirm=0)
upgrade_decision.plan()
self.tic()
self._simulateUpgradeDecision_upgradeHostingSubscription("False")
self._simulateUpgradeDecision_upgradeComputer()
self._simulateScript('UpgradeDecision_notify')
try:
self.portal.portal_alarms.slapos_upgrade_decision_process.activeSense()
self.portal.portal_alarms.slapos_pdm_upgrade_decision_process_planned.\
activeSense()
self.tic()
finally:
self._dropUpgradeDecision_upgradeHostingSubscription()
self._dropUpgradeDecision_upgradeComputer()
self.assertEqual(
'Visited by UpgradeDecision_upgradeComputer',
upgrade_decision.workflow_history['edit_workflow'][-1]['comment'])
self._dropScript('UpgradeDecision_notify')
self.assertEqual('Visited by UpgradeDecision_notify',
upgrade_decision.workflow_history['edit_workflow'][-1]['comment'])
def _simulateComputer_checkAndCreateUpgradeDecision(self):
script_name = 'Computer_checkAndCreateUpgradeDecision'
if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom,
script_name,
'*args, **kw',
'# Script body\n'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
'Visited by Computer_checkAndCreateUpgradeDecision')
transaction.commit()
def _dropComputer_checkAndCreateUpgradeDecision(self):
script_name = 'Computer_checkAndCreateUpgradeDecision'
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit()
def test_Alarm_computerCheckUpgradeSoftwareRelease(self):
def test_alarm_computer_create_upgrade_decision(self):
computer = self._makeComputer(self.new_id)
computer.edit(allocation_scope = 'open/public')
computer2 = self._makeComputer(self.generateNewId())
computer2.edit(allocation_scope = 'open/personal')
self._simulateComputer_checkAndCreateUpgradeDecision()
self._simulateScript('Computer_checkAndCreateUpgradeDecision')
try:
self.portal.portal_alarms.slapos_pdm_computer_create_upgrade_decision.\
activeSense()
self.tic()
finally:
self._dropComputer_checkAndCreateUpgradeDecision()
self._dropScript('Computer_checkAndCreateUpgradeDecision')
self.assertEqual('Visited by Computer_checkAndCreateUpgradeDecision',
computer.workflow_history['edit_workflow'][-1]['comment'])
......@@ -139,39 +107,19 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
self.assertNotEqual('Visited by Computer_checkAndCreateUpgradeDecision',
computer2.workflow_history['edit_workflow'][-1]['comment'])
def _simulateComputer_hostingSubscriptionCreateUpgradeDecision(self):
script_name = 'Computer_hostingSubscriptionCreateUpgradeDecision'
if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom,
script_name,
'*args, **kw',
'# Script body\n'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision')
transaction.commit()
def _dropComputer_hostingSubscriptionCreateUpgradeDecision(self):
script_name = 'Computer_hostingSubscriptionCreateUpgradeDecision'
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit()
def test_Alarm_computerCheckUpgradeHostingSubscription(self):
def test_alarm_hosting_subscription_create_upgrade_decision(self):
computer = self._makeComputer(self.new_id)
computer.edit(allocation_scope = 'open/public')
computer2 = self._makeComputer(self.generateNewId())
computer2.edit(allocation_scope = 'open/personal')
self._simulateComputer_hostingSubscriptionCreateUpgradeDecision()
self._simulateScript('Computer_hostingSubscriptionCreateUpgradeDecision')
try:
self.portal.portal_alarms.slapos_hosting_subscription_create_upgrade_decision.\
self.portal.portal_alarms.slapos_pdm_hosting_subscription_create_upgrade_decision.\
activeSense()
self.tic()
finally:
self._dropComputer_hostingSubscriptionCreateUpgradeDecision()
self._dropScript('Computer_hostingSubscriptionCreateUpgradeDecision')
self.assertEqual('Visited by Computer_hostingSubscriptionCreateUpgradeDecision',
computer.workflow_history['edit_workflow'][-1]['comment'])
......@@ -179,4 +127,3 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
self.assertNotEqual('Visited by Computer_hostingSubscriptionCreateUpgradeDecision',
computer2.workflow_history['edit_workflow'][-1]['comment'])
\ No newline at end of file
......@@ -22,7 +22,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Confirmed</string> </value>
<value> <string>Available</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
......
......@@ -36,6 +36,8 @@
<string>delete_action</string>
<string>plan</string>
<string>plan_action</string>
<string>reject</string>
<string>reject_action</string>
<string>start</string>
<string>start_action</string>
</tuple>
......
......@@ -22,7 +22,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <string>Planned</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
......
15
\ No newline at end of file
28
\ No newline at end of file
portal_alarms/slapos_hosting_subscription_create_upgrade_decision
portal_alarms/slapos_manage_software_catalog
portal_alarms/slapos_pdm_computer_create_upgrade_decision
portal_alarms/slapos_upgrade_decision_process
portal_alarms/slapos_pdm_hosting_subscription_create_upgrade_decision
portal_alarms/slapos_pdm_upgrade_decision_process_planned
portal_alarms/slapos_pdm_upgrade_decision_process_started
software_product_module/template_software_product
software_release_module/template_software_release
upgrade_decision_module/template_upgrade_decision
\ No newline at end of file
Software Product | -validation_workflow
Software Product | commerce_validation_workflow
Upgrade Decision | edit_workflow
Upgrade Decision | upgrade_decision_workflow
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_web_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_web_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>web_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>0.5</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/UpgradeDecision_viewAsWeb</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: object is not None and object.isWebMode()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>your_custom_title</string>
<string>my_text_content</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>my_start_date</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_viewRawDescription</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Event_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Event</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -51,7 +51,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
kw[\'portal_type\'] = ["Support Request", "Regularisation Request"]\n
kw[\'portal_type\'] = ["Support Request", "Regularisation Request", "Upgrade Decision"]\n
\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
if person:\n
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......
60
\ No newline at end of file
61
\ 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