Commit 7ed15e47 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

Split Alarm script Computer_checkAndUpdateAllocationScope

parent 278cf032
master alain-message amarisoft cli_request_parameters_file cln-fixes dev/buildout_rebase_experiments feat/cli_request_file feat/improve_testcase feat/ipv6_range feat/ipv6_range_and_tun feat/ipv6_range_custom_prefixshift feat/node-secrets feat/openapi feat/rewrite-slapformat feat/slap-connection-include-shared-parts feat/slapgrid_report_stalled feat/slapos-service-list-limit feat/standalone-service feat/testcase_upgrade_test feature/cgroups feature/format-crumbled feature/manager-cpuset fix-invoicing fix/instance-python-executable-inspection fix/ipv6_tap_netmask fix/promise_preexec_fn_deadlock fix/proxy-output fix/request_without_timeout fix/revert_slappopen_threading fix/slapformat_after_ipv6_range_and_tun fix/slapos-ansible fix/slappopen_pipes_and_timeout fix/slappopen_test_timeouts fix/standalone-all fix_promise_logging fix_promise_logging_again fix_slapformat_python3 fix_standalone_format forward_state_propagation improve_proxy_root_path improve_slapos_cli instance_python_promises instance_state_propagation master-dev message-box nicolas-improve-attention-point promises_with_instance_python proxy-child-instance-name-collisions proxy_relative_urls proxy_root_path_migrate refactor/format slapformat_in_standalone slapgrid_no_supervisord slapproxy_frontend slapproxy_hatoeas standalone/increase_slapos_error_log_tail_size standalone_node_auto standalone_proxy_path standalone_slapformat_on_no_supervisord standalone_with_hateoas tests tomo_fix_slapos_configurator transparent_json_in_xml 1.6.14 1.6.13 1.6.12 1.6.11 1.6.10 1.6.9 1.6.8 1.6.7 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.12 1.5.11 1.5.10 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.28 1.4.27 1.4.26 1.4.25 1.4.24 1.4.23 1.4.22 1.4.21 1.4.20 1.4.19 1.4.17 1.4.16 1.4.15 1.4.14 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.18 1.3.17 1.3.16 1.3.15 1.3.14 1.3.13 1.3.12 1.3.11 1.3.10 1.3.9 1.3.8 1.3.7 1.3.6.3 1.3.6.2 1.3.6.1 1.3.6 1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 master-20180917
No related merge requests found
...@@ -50,9 +50,7 @@ ...@@ -50,9 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>from DateTime import DateTime\n
from DateTime import DateTime\n
\n \n
computer = context\n computer = context\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
...@@ -65,6 +63,8 @@ if allocation_scope != \'open/public\' and \\\n ...@@ -65,6 +63,8 @@ if allocation_scope != \'open/public\' and \\\n
\n \n
is_service_provider = False\n is_service_provider = False\n
person = computer.getSourceAdministrationValue(portal_type="Person")\n person = computer.getSourceAdministrationValue(portal_type="Person")\n
if not person:\n
return\n
\n \n
for assignment in person.contentValues(portal_type="Assignment"):\n for assignment in person.contentValues(portal_type="Assignment"):\n
if assignment.getRole() == \'service_provider\':\n if assignment.getRole() == \'service_provider\':\n
...@@ -79,6 +79,7 @@ if not is_service_provider:\n ...@@ -79,6 +79,7 @@ if not is_service_provider:\n
computer.edit(**edit_kw)\n computer.edit(**edit_kw)\n
\n \n
# Create a ticket (or re-open it) for this issue!\n # Create a ticket (or re-open it) for this issue!\n
support_request = None\n
request_title = \'Allocation scope has been changed for %s\' % computer_reference\n request_title = \'Allocation scope has been changed for %s\' % computer_reference\n
request_description = \'Allocation scope has been changed back to \' \\\n request_description = \'Allocation scope has been changed back to \' \\\n
\'open/personal for %s\' % computer_reference\n \'open/personal for %s\' % computer_reference\n
...@@ -86,7 +87,6 @@ if not is_service_provider:\n ...@@ -86,7 +87,6 @@ if not is_service_provider:\n
notification_reference = \'slapos-crm-computer_allocation_scope.notification\'\n notification_reference = \'slapos-crm-computer_allocation_scope.notification\'\n
notification_message = portal.portal_notifications.getDocumentValue(\n notification_message = portal.portal_notifications.getDocumentValue(\n
reference=notification_reference)\n reference=notification_reference)\n
ressource = portal.service_module.slapos_crm_information.getRelativeUrl()\n
mapping_dict = {\'computer_title\':computer.getTitle(),\n mapping_dict = {\'computer_title\':computer.getTitle(),\n
\'computer_id\':computer_reference,\n \'computer_id\':computer_reference,\n
\'allocation_scope\':allocation_scope}\n \'allocation_scope\':allocation_scope}\n
...@@ -113,32 +113,10 @@ if not is_service_provider:\n ...@@ -113,32 +113,10 @@ if not is_service_provider:\n
if support_request is None:\n if support_request is None:\n
# Existing ticket not found, can not create event for the moment\n # Existing ticket not found, can not create event for the moment\n
return\n return\n
support_request_url = support_request.getRelativeUrl()\n
\n \n
# create Web message if needed for this ticket\n support_request.SupportRequest_trySendNotificationMessage(message_title,\n
last_event = context.portal_catalog.getResultValue(\n message, person.getRelativeUrl())\n
follow_up_uid=support_request.getUid(), \n </string> </value>
sort_on=[(\'delivery.start_date\', \'DESC\')],\n
)\n
if last_event and \\\n
(DateTime() - last_event.getStartDate() < 1):\n
# User has already been notified this last 24h.\n
return\n
event = portal.event_module.slapos_crm_web_message_template.\\\n
Base_createCloneDocument(batch_mode=1)\n
event.edit(\n
title=message_title,\n
text_content=message,\n
start_date = DateTime(),\n
resource = ressource,\n
source=person.getRelativeUrl(),\n
follow_up=support_request_url,\n
)\n
event.stop()\n
event.deliver()\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</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 encoding="cdata"><![CDATA[
support_request = context\n
portal = context.getPortalObject()\n
\n
ressource = portal.service_module.slapos_crm_information.getRelativeUrl()\n
# create Web message if needed for this ticket\n
last_event = context.portal_catalog.getResultValue(\n
follow_up_uid=support_request.getUid(), \n
sort_on=[(\'delivery.start_date\', \'DESC\')],\n
)\n
if last_event and \\\n
(DateTime() - last_event.getStartDate() < 1):\n
# User has already been notified this last 24h.\n
return\n
event = portal.event_module.slapos_crm_web_message_template.\\\n
Base_createCloneDocument(batch_mode=1)\n
event.edit(\n
title=message_title,\n
text_content=message,\n
start_date = DateTime(),\n
resource = ressource,\n
source=source_relative_url,\n
follow_up=support_request.getRelativeUrl(),\n
)\n
event.stop()\n
event.deliver()\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>message_title, message, source_relative_url</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequest_trySendNotificationMessage</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
33 34
\ No newline at end of file \ No newline at end of file
...@@ -4,6 +4,8 @@ portal_alarms/slapos_check_cloud_is_full ...@@ -4,6 +4,8 @@ portal_alarms/slapos_check_cloud_is_full
portal_alarms/slapos_check_computer_state portal_alarms/slapos_check_computer_state
portal_alarms/slapos_check_software_instance_state portal_alarms/slapos_check_software_instance_state
portal_alarms/slapos_crm_cancel_invoice portal_alarms/slapos_crm_cancel_invoice
portal_alarms/slapos_crm_check_partially_allocated_instance
portal_alarms/slapos_crm_check_update_allocation_scope
portal_alarms/slapos_crm_create_regularisation_request portal_alarms/slapos_crm_create_regularisation_request
portal_alarms/slapos_crm_delete_hosting_subscription portal_alarms/slapos_crm_delete_hosting_subscription
portal_alarms/slapos_crm_invalidate_suspended_regularisation_request portal_alarms/slapos_crm_invalidate_suspended_regularisation_request
......
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