Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.core
Commits
7ed15e47
Commit
7ed15e47
authored
Jul 24, 2014
by
Alain Takoudjou
Committed by
Rafael Monnerat
Nov 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split Alarm script Computer_checkAndUpdateAllocationScope
parent
278cf032
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
825 deletions
+108
-825
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_check_update_allocation_scope.xml
...ortal_alarms/slapos_crm_check_update_allocation_scope.xml
+0
-792
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Computer_checkAndUpdateAllocationScope.xml
...ins/slapos_crm/Computer_checkAndUpdateAllocationScope.xml
+10
-32
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SupportRequest_trySendNotificationMessage.xml
.../slapos_crm/SupportRequest_trySendNotificationMessage.xml
+95
-0
master/bt5/slapos_crm/bt/revision
master/bt5/slapos_crm/bt/revision
+1
-1
master/bt5/slapos_crm/bt/template_path_list
master/bt5/slapos_crm/bt/template_path_list
+2
-0
No files found.
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_check_update_allocation_scope.xml
View file @
7ed15e47
This diff is collapsed.
Click to expand it.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Computer_checkAndUpdateAllocationScope.xml
View file @
7ed15e47
...
@@ -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>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SupportRequest_trySendNotificationMessage.xml
0 → 100644
View file @
7ed15e47
<?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>
master/bt5/slapos_crm/bt/revision
View file @
7ed15e47
33
34
\ No newline at end of file
\ No newline at end of file
master/bt5/slapos_crm/bt/template_path_list
View file @
7ed15e47
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment