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
Łukasz Nowak
slapos.core
Commits
bebf7b6a
Commit
bebf7b6a
authored
Feb 03, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Refactor, clean up and optimize Support Request Generation for Monitoring
parent
339fba9c
Changes
26
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1632 additions
and
1588 deletions
+1632
-1588
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_check_computer_state.xml
...ateItem/portal_alarms/slapos_crm_check_computer_state.xml
+2
-4
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_check_instance_in_error.xml
...Item/portal_alarms/slapos_crm_check_instance_in_error.xml
+2
-2
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_check_update_personal_allocation_scope.xml
...rms/slapos_crm_check_update_personal_allocation_scope.xml
+9
-13
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdateComputerAllocationScope.xml
...onitoring/Alarm_checkAndUpdateComputerAllocationScope.xml
+2
-19
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdatePersonalComputerAllocationScope.xml
...g/Alarm_checkAndUpdatePersonalComputerAllocationScope.xml
+12
-25
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkHostingSubscriptionState.xml
...os_crm_monitoring/Alarm_checkHostingSubscriptionState.xml
+6
-10
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Base_generateSupportRequestForSlapOS.xml
...s_crm_monitoring/Base_generateSupportRequestForSlapOS.xml
+22
-12
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdateAllocationScope.xml
...crm_monitoring/Computer_checkAndUpdateAllocationScope.xml
+11
-22
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdatePersonalAllocationScope.xml
...toring/Computer_checkAndUpdatePersonalAllocationScope.xml
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkState.xml
...ortal_skins/slapos_crm_monitoring/Computer_checkState.xml
+12
-33
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ERP5Site_isSupportRequestCreationClosed.xml
...rm_monitoring/ERP5Site_isSupportRequestCreationClosed.xml
+7
-3
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/HostingSubscription_checkSoftwareInstanceState.xml
...toring/HostingSubscription_checkSoftwareInstanceState.xml
+32
-25
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/HostingSubscription_createSupportRequestEvent.xml
...itoring/HostingSubscription_createSupportRequestEvent.xml
+103
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Person_isServiceProvider.xml
..._skins/slapos_crm_monitoring/Person_isServiceProvider.xml
+2
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstallation_hasReportedError.xml
..._crm_monitoring/SoftwareInstallation_hasReportedError.xml
+21
-13
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_checkState.xml
...ins/slapos_crm_monitoring/SoftwareInstance_checkState.xml
+0
-138
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_hasReportedError.xml
...apos_crm_monitoring/SoftwareInstance_hasReportedError.xml
+23
-18
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_trySendNotificationMessage.xml
..._monitoring/SupportRequest_trySendNotificationMessage.xml
+11
-11
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+339
-0
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
...teItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
+30
-3
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+950
-158
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.xml
...teItem/portal_components/test.erp5.testSlapOSCRMSkins.xml
+31
-17
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSupportRequestGeneration.py
...onents/test.erp5.testSlapOSCRMSupportRequestGeneration.py
+0
-950
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSupportRequestGeneration.xml
...nents/test.erp5.testSlapOSCRMSupportRequestGeneration.xml
+0
-105
master/bt5/slapos_crm/bt/template_path_list
master/bt5/slapos_crm/bt/template_path_list
+3
-3
master/bt5/slapos_crm/bt/template_test_id_list
master/bt5/slapos_crm/bt/template_test_id_list
+1
-2
No files found.
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_check_computer_state.xml
→
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_c
rm_c
heck_computer_state.xml
View file @
bebf7b6a
...
@@ -12,9 +12,7 @@
...
@@ -12,9 +12,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<value>
<string>
Check if a public or a friend computer contacted master recently and create a ticket if the computer stops to contact master after some time.
</string>
</value>
<none/>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
...
@@ -22,7 +20,7 @@
...
@@ -22,7 +20,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_check_computer_state
</string>
</value>
<value>
<string>
slapos_c
rm_c
heck_computer_state
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<key>
<string>
periodicity_hour
</string>
</key>
...
...
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_check_
partially_allocated_instance
.xml
→
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_check_
instance_in_error
.xml
View file @
bebf7b6a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_
findAndNofitiyUnallocatedSoftwareInstanc
e
</string>
</value>
<value>
<string>
Alarm_
checkHostingSubscriptionStat
e
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_crm_check_
partially_allocated_instance
</string>
</value>
<value>
<string>
slapos_crm_check_
instance_in_error
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<key>
<string>
periodicity_hour
</string>
</key>
...
...
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_c
heck_software_instance_stat
e.xml
→
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_c
rm_check_update_personal_allocation_scop
e.xml
View file @
bebf7b6a
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_check
SoftwareInstanceStat
e
</string>
</value>
<value>
<string>
Alarm_check
AndUpdatePersonalComputerAllocationScop
e
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<string>
Vefity the state of the instances which are hosted on public servers
.
</string>
</value>
<value>
<string>
Automatically turn allocation scope of personal computer to closed if the computer were never used
.
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_c
heck_software_instance_stat
e
</string>
</value>
<value>
<string>
slapos_c
rm_check_update_personal_allocation_scop
e
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<key>
<string>
periodicity_hour
</string>
</key>
...
@@ -28,21 +28,17 @@
...
@@ -28,21 +28,17 @@
<tuple/>
<tuple/>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
periodicity_hour_frequency
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<value>
<tuple/>
<tuple>
<int>
5
</int>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<value>
<int>
1
</int>
</value>
<none/>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<key>
<string>
periodicity_month
</string>
</key>
...
@@ -68,7 +64,7 @@
...
@@ -68,7 +64,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
13
7760864
0.0
</float>
<float>
13
9942080
0.0
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
@@ -93,7 +89,7 @@
...
@@ -93,7 +89,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string>
Check
instances\' stat
e
</string>
</value>
<value>
<string>
Check
and Update Personal Computer Allocation Scop
e
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdateComputerAllocationScope.xml
View file @
bebf7b6a
...
@@ -50,13 +50,10 @@
...
@@ -50,13 +50,10 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string>
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
category_public = portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None)\n
category_public = portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None)\n
category_friend = portal.restrictedTraverse("portal_categories/allocation_scope/open/friend", None)\n
category_friend = portal.restrictedTraverse("portal_categories/allocation_scope/open/friend", None)\n
category_personal = portal.restrictedTraverse("portal_categories/allocation_scope/open/personal", None)\n
\n
\n
if category_public is not None:\n
if category_public is not None:\n
portal.portal_catalog.searchAndActivate(\n
portal.portal_catalog.searchAndActivate(\n
...
@@ -67,22 +64,8 @@ if category_public is not None:\n
...
@@ -67,22 +64,8 @@ if category_public is not None:\n
activate_kw={\'tag\': tag}\n
activate_kw={\'tag\': tag}\n
)\n
)\n
\n
\n
if category_personal is not None:\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Computer\', \n
validation_state=\'validated\', \n
modification_date=(DateTime() - 30).strftime(\'<=%Y/%m/%d\'), \n
order_by=((\'modification_date\', "ASC"), ), \n
default_allocation_scope_uid=category_personal.getUid(), \n
left_join_list=[\'aggregate_related_uid\'], \n
aggregate_related_uid=None,\n
method_id=\'Computer_checkAndUpdatePersonalAllocationScope\',\n
activate_kw={\'tag\': tag})\n
\n
context.activate(after_tag=tag).getId()\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
]]>
</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_monitoring/Alarm_
findAndNofitiyUnallocatedSoftwareInstanc
e.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_
checkAndUpdatePersonalComputerAllocationScop
e.xml
View file @
bebf7b6a
...
@@ -54,32 +54,19 @@
...
@@ -54,32 +54,19 @@
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
#Get all unallocated Software Instance\n
category_personal = portal.restrictedTraverse("portal_categories/allocation_scope/open/personal", None)\n
select_dict= {\'default_aggregate_uid\': None}\n
software_instance_list = context.portal_catalog(\n
portal_type=["Software Instance", "Slave Instance"],\n
validation_state="validated",\n
# Do not fetch destroyed instances\n
# XXX slap_state=["start_requested", "stop_requested"],\n
default_aggregate_uid=None,\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
group_by="specialise_uid"\n
)\n
\n
\n
# Get the list of concerned Hosting Subscription reference\n
if category_personal is not None:\n
hs_reference_list = [si.getSpecialiseReference() for si in software_instance_list \n
if si.getSlapState() in [\'start_requested\', \'stop_requested\']\n
]\n
\n
if len(hs_reference_list) >
0:\n
portal.portal_catalog.searchAndActivate(\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Hosting Subscription\',\n
portal_type=\'Computer\', \n
validation_state=\'validated\',\n
validation_state=\'validated\', \n
reference=hs_reference_list,\n
modification_date=(DateTime() - 30).strftime(\'<=%Y/%m/%d\'), \n
method_id=\'HostingSubscription_checkSofwareInstanceAllocationState\',\n
order_by=((\'modification_date\', "ASC"), ), \n
activate_kw = {\'tag\':tag}\n
default_allocation_scope_uid=category_personal.getUid(), \n
)\n
left_join_list=[\'aggregate_related_uid\'], \n
aggregate_related_uid=None,\n
method_id=\'Computer_checkAndUpdatePersonalAllocationScope\',\n
activate_kw={\'tag\': tag})\n
\n
\n
context.activate(after_tag=tag).getId()\n
context.activate(after_tag=tag).getId()\n
...
@@ -92,7 +79,7 @@ context.activate(after_tag=tag).getId()\n
...
@@ -92,7 +79,7 @@ context.activate(after_tag=tag).getId()\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_
findAndNofitiyUnallocatedSoftwareInstanc
e
</string>
</value>
<value>
<string>
Alarm_
checkAndUpdatePersonalComputerAllocationScop
e
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_check
SoftwareInstance
State.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_check
HostingSubscription
State.xml
View file @
bebf7b6a
...
@@ -51,16 +51,12 @@
...
@@ -51,16 +51,12 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
<value>
<string>
portal = context.getPortalObject()\n
category_uid = portal.restrictedTraverse(\n
"portal_categories/allocation_scope/open/public", None).getUid()\n
\n
\n
if category_uid is not None:\n
portal.portal_catalog.searchAndActivate(\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Hosting Subscription\',\n
portal_type = \'Computer\',\n
validation_state=\'validated\',\n
validation_state = \'validated\',\n
method_id=\'HostingSubscription_checkSofwareInstanceState\',\n
default_allocation_scope_uid = category_uid,\n
activate_kw = {\'tag\':tag}\n
method_id = \'Computer_checkSoftwareInstanceState\',\n
activate_kw = {\'tag\':tag} \n
)\n
)\n
\n
\n
context.activate(after_tag=tag).getId()\n
context.activate(after_tag=tag).getId()\n
...
@@ -72,7 +68,7 @@ context.activate(after_tag=tag).getId()\n
...
@@ -72,7 +68,7 @@ context.activate(after_tag=tag).getId()\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_check
SoftwareInstance
State
</string>
</value>
<value>
<string>
Alarm_check
HostingSubscription
State
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Base_generateSupportRequestForSlapOS.xml
View file @
bebf7b6a
...
@@ -61,6 +61,8 @@ elif source_project_value.getPortalType() == "Software Instance":\n
...
@@ -61,6 +61,8 @@ elif source_project_value.getPortalType() == "Software Instance":\n
destination_decision = source_project_value.getSpecialiseValue().getDestinationSection()\n
destination_decision = source_project_value.getSpecialiseValue().getDestinationSection()\n
elif source_project_value.getPortalType() == "Hosting Subscription":\n
elif source_project_value.getPortalType() == "Hosting Subscription":\n
destination_decision = source_project_value.getDestinationSection()\n
destination_decision = source_project_value.getDestinationSection()\n
elif source_project_value.getPortalType() == "Software Installation":\n
destination_decision = source_project_value.getDestinationSection()\n
else:\n
else:\n
destination_decision = None\n
destination_decision = None\n
\n
\n
...
@@ -68,33 +70,41 @@ if portal.ERP5Site_isSupportRequestCreationClosed(destination_decision):\n
...
@@ -68,33 +70,41 @@ if portal.ERP5Site_isSupportRequestCreationClosed(destination_decision):\n
# Stop ticket creation\n
# Stop ticket creation\n
return\n
return\n
\n
\n
if not title.startswith(\'[MONITORING]\'):\n
title = \'[MONITORING] \' + title\n
support_request_in_progress = portal.portal_catalog.getResultValue(\n
support_request_in_progress = portal.portal_catalog.getResultValue(\n
portal_type = \'Support Request\',\n
portal_type = \'Support Request\',\n
title = title,\n
title = title,\n
simulation_state = ["validated",
"submitted",
"suspended"],\n
simulation_state = ["validated",
"submitted",
"suspended"],\n
source_project_uid = source_project_value.getUid()\n
source_project_uid = source_project_value.getUid()
,
\n
)\n
)\n
\n
\n
if support_request_in_progress is None:\n
if support_request_in_progress is not None:\n
ressource = portal.service_module.\\\n
return support_request_in_progress\n
\n
support_request_in_progress = context.REQUEST.get("support_request_in_progress", None)\n
\n
if support_request_in_progress is not None:\n
return portal.restrictedTraverse(support_request_in_progress)\n
\n
resource = portal.service_module.\\\n
slapos_crm_monitoring.getRelativeUrl()\n
slapos_crm_monitoring.getRelativeUrl()\n
support_request = portal.\\\n
\n
support_request = portal.\\\n
support_request_module.\\\n
support_request_module.\\\n
slapos_crm_support_request_template_for_monitoring.\\\n
slapos_crm_support_request_template_for_monitoring.\\\n
Base_createCloneDocument(batch_mode=1)\n
Base_createCloneDocument(batch_mode=1)\n
support_request.edit(\n
support_request.edit(\n
title = title,\n
title = title,\n
description = description,\n
description = description,\n
start_date = DateTime(),\n
start_date = DateTime(),\n
destination_decision=destination_decision,\n
destination_decision=destination_decision,\n
source_project_value = source_
relative_url
,\n
source_project_value = source_
project_value
,\n
res
source=res
source\n
res
ource=re
source\n
)\n
)\n
support_request.validate()\n
support_request.validate()\n
\n
context.REQUEST.set("support_request_in_progress", support_request.getRelativeUrl())\n
\n
\n
return support_request.getRelativeUrl()
\n
return support_request
\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdateAllocationScope.xml
View file @
bebf7b6a
...
@@ -74,33 +74,21 @@ if not person.Person_isServiceProvider():\n
...
@@ -74,33 +74,21 @@ if not person.Person_isServiceProvider():\n
}\n
}\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 = \'We have changed allocation scope for %s\' % computer_reference\n
request_title = \'We have changed allocation scope for %s\' % computer_reference\n
request_description = \'Allocation scope has been changed to \' \\\n
request_description = \'Allocation scope has been changed to \' \\\n
\'%s for %s\' % (target_allocation_scope, computer_reference)\n
\'%s for %s\' % (target_allocation_scope, computer_reference)\n
\n
\n
support_request
_url
= context.Base_generateSupportRequestForSlapOS(\n
support_request = context.Base_generateSupportRequestForSlapOS(\n
request_title,\n
request_title,\n
request_description,\n
request_description,\n
computer.getRelativeUrl()\n
computer.getRelativeUrl()\n
)\n
)\n
if support_request_url:\n
\n
support_request = portal.restrictedTraverse(support_request_url)\n
if support_request.getSimulationState() != "validated":\n
support_request.suspend()\n
support_request.validate()\n
else:\n
# XXX - Base_generateSupportRequestForSlapOS return None if the \n
# support_request already exist, but we want to use it again so...\n
support_request = portal.portal_catalog.getResultValue(\n
portal_type = \'Support Request\',\n
title = request_title,\n
simulation_state = [\'suspended\', \'open\'],\n
source_project_uid = computer.getUid()\n
)\n
if support_request is None:\n
# Existing ticket not found, can not create event for the moment\n
return\n
\n
\n
# Send notification message\n
# Send notification message\n
message = request_description\n
notification_message = portal.portal_notifications.getDocumentValue(\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=notification_message_reference)\n
reference=notification_message_reference)\n
\n
\n
...
@@ -108,16 +96,17 @@ if not person.Person_isServiceProvider():\n
...
@@ -108,16 +96,17 @@ if not person.Person_isServiceProvider():\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
\n
message = notification_message.asText(\n
message = notification_message.asText(\n
substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
substitution_method_parameter_dict={\'mapping_dict\': mapping_dict})\n
else:\n
message = request_description\n
\n
\n
event = support_request.SupportRequest_trySendNotificationMessage(
request_title,
\n
event = support_request.SupportRequest_trySendNotificationMessage(\n
message, person.getRelativeUrl())\n
request_title,
message, person.getRelativeUrl())\n
\n
\n
if event is not None:\n
if event is not None:\n
computer.edit(**edit_kw)\n
computer.edit(**edit_kw)\n
\n
return support_request\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdatePersonalAllocationScope.xml
View file @
bebf7b6a
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
context.Computer_checkAndUpdateAllocationScope(\n
<value>
<string>
return
context.Computer_checkAndUpdateAllocationScope(\n
target_allocation_scope = \'close/termination\',\n
target_allocation_scope = \'close/termination\',\n
notification_message_reference=\'slapos-crm-computer_personal_allocation_scope.notification\')\n
notification_message_reference=\'slapos-crm-computer_personal_allocation_scope.notification\')\n
</string>
</value>
</string>
</value>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkState.xml
View file @
bebf7b6a
...
@@ -76,8 +76,8 @@ try:\n
...
@@ -76,8 +76,8 @@ try:\n
d = memcached_dict[reference]\n
d = memcached_dict[reference]\n
d = json.loads(d)\n
d = json.loads(d)\n
last_contact = DateTime(d.get(\'created_at\'))\n
last_contact = DateTime(d.get(\'created_at\'))\n
if (DateTime() - last_contact) >
1:\n
if (DateTime() - last_contact) >
0.0
1:\n
description = "The Computer %s (%s) has not contacted the server for more than
24 hour
s" \\\n
description = "The Computer %s (%s) has not contacted the server for more than
30 minute
s" \\\n
"(last contact date: %s)" % (computer_title, reference, last_contact)\n
"(last contact date: %s)" % (computer_title, reference, last_contact)\n
else:\n
else:\n
should_notify = False\n
should_notify = False\n
...
@@ -85,58 +85,37 @@ except KeyError:\n
...
@@ -85,58 +85,37 @@ except KeyError:\n
ticket_title = "[MONITORING] No information about %s" % reference\n
ticket_title = "[MONITORING] No information about %s" % reference\n
description = "The Computer %s (%s) has not contacted the server (No Contact Information)" % (\n
description = "The Computer %s (%s) has not contacted the server (No Contact Information)" % (\n
computer_title, reference)\n
computer_title, reference)\n
\n
\n
\n
if should_notify:\n
if should_notify:\n
support_request
_url
= context.Base_generateSupportRequestForSlapOS(\n
support_request = context.Base_generateSupportRequestForSlapOS(\n
ticket_title,\n
ticket_title,\n
description,\n
description,\n
context.getRelativeUrl()\n
context.getRelativeUrl()\n
)\n
)\n
\n
\n
support_request = None\n
person = context.getSourceAdministrationValue(portal_type="Person")\n
person = context.getSourceAdministrationValue(portal_type="Person")\n
if not person:\n
if not person:\n
return support_request_url\n
return support_request\n
\n
\n
if support_request_url:\n
support_request = portal.restrictedTraverse(support_request_url, None)\n
else:\n
# XXX - the support request might already exists\n
support_request = portal.portal_catalog.getResultValue(\n
portal_type = \'Support Request\',\n
title = ticket_title,\n
simulation_state = \'validated\',\n
source_project_uid = context.getUid()\n
)\n
if support_request is None:\n
# Existing ticket not found, can not create event for the moment\n
return support_request_url\n
\n
# Send Notification message\n
# Send Notification message\n
notification_reference = \'slapos-crm-computer_check_state.notification\'\n
notification_reference = \'slapos-crm-computer_check_state.notification\'\n
notification_message = portal.portal_notifications.getDocumentValue(\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=notification_reference)\n
reference=notification_reference)\n
if notification_message is None:\n
message = """Dear user,\n
%s.\n
Do not hesitate to visit the web forum (http://community.slapos.org/forum) in case of question.\n
\n
\n
Regards,\n
if notification_message is None:\n
\n
message = """%s""" % description\n
The slapos team""" % description\n
else:\n
else:\n
mapping_dict = {\'computer_title\':context.getTitle(),\n
mapping_dict = {\'computer_title\':context.getTitle(),\n
\'computer_id\':reference,\n
\'computer_id\':reference,\n
\'last_contact\':last_contact}\n
\'last_contact\':last_contact}\n
message = notification_message.asText(\n
message = notification_message.asText(\n
substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
\n
\n
support_request.SupportRequest_trySendNotificationMessage(\n
support_request.SupportRequest_trySendNotificationMessage(\n
ticket_title
.replace(\'[MONITORING] \', \'\')
,\n
ticket_title,\n
message, person.getRelativeUrl()
, 5
)\n
message, person.getRelativeUrl())\n
\n
\n
return support_request
_url
\n
return support_request\n
]]>
</string>
</value>
]]>
</string>
</value>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ERP5Site_isSupportRequestCreationClosed.xml
View file @
bebf7b6a
...
@@ -50,7 +50,9 @@
...
@@ -50,7 +50,9 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
# HARDCODED LIMIT TO BE MOVED TO GLOBAL PREFERENCES\n
<value>
<string
encoding=
"cdata"
>
<![CDATA[
# HARDCODED LIMIT TO BE MOVED TO GLOBAL PREFERENCES\n
limit = 5\n
limit = 5\n
\n
\n
kw[\'limit\'] = limit\n
kw[\'limit\'] = limit\n
...
@@ -62,8 +64,10 @@ if destination_decision:\n
...
@@ -62,8 +64,10 @@ if destination_decision:\n
\n
\n
support_request_list = context.portal_catalog(**kw)\n
support_request_list = context.portal_catalog(**kw)\n
\n
\n
return len(support_request_list) == limit\n
return len(support_request_list) >
= limit\n
</string>
</value>
]]>
</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_monitoring/HostingSubscription_checkSof
wareInstanceAllocation
State.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/HostingSubscription_checkSof
twareInstance
State.xml
View file @
bebf7b6a
...
@@ -62,38 +62,45 @@ if portal.ERP5Site_isSupportRequestCreationClosed():\n
...
@@ -62,38 +62,45 @@ if portal.ERP5Site_isSupportRequestCreationClosed():\n
# Stop ticket creation\n
# Stop ticket creation\n
return\n
return\n
\n
\n
hs_title = hosting_subscription.getTitle()\n
date_check_limit = addToDate(DateTime(), to_add={\'hour\': -1})\n
date_check_limit = addToDate(DateTime(), to_add={\'hour\': -4})\n
\n
if (date_check_limit - hosting_subscription.getCreationDate()) < 0:\n
# Too early to check\n
return\n
\n
#if not source_instance:\n
# return\n
\n
software_instance_list = hosting_subscription.getSpecialiseRelatedValueList(\n
portal_type=["Software Instance", "Slave Instance"])\n
\n
has_newest_allocated_instance = False\n
has_newest_allocated_instance = False\n
has_unallocated_instance = False\n
has_unallocated_instance = False\n
source_instance = hosting_subscription.getPredecessorValue()\n
failing_instance = None\n
failing_instance = None\n
\n
\n
if not source_instance:\n
return\n
software_instance_list = [source_instance]\n
predecessors_instance = source_instance.getPredecessorValueList()\n
if len(predecessors_instance) >
0:\n
software_instance_list.extend(predecessors_instance)\n
\n
# Check if at least one software Instance is Allocated\n
# Check if at least one software Instance is Allocated\n
for instance in software_instance_list:\n
for instance in software_instance_list:\n
if instance.getAggregate("") != "":\n
if instance.getSlapState() not in ["start_requested", "stop_requested"]:\n
if (instance.getCreationDate() - date_check_limit)
< 0:
\n
continue\n
#
This
instance
is
created
for
more
than
4
hours\n
\n
if (date_check_limit - instance.getCreationDate()) < 0:\n
continue\n
\n
if instance.getAggregateValue() is not None:\n
has_newest_allocated_instance = True\n
has_newest_allocated_instance = True\n
if instance.getPortalType() == "Software Instance" and \\\n
instance.SoftwareInstance_hasReportedError():\n
return context.HostingSubscription_createSupportRequestEvent(\n
instance, \'slapos-crm-hosting-subscription-instance-state.notification\')\n
else:\n
else:\n
has_unallocated_instance = True\n
has_unallocated_instance = True\n
failing_instance = instance\n
failing_instance = instance\n
\n
\n
if
has_unallocated_instance
and
has_newest_allocated_instance:\n
if has_unallocated_instance and has_newest_allocated_instance:\n
return
context.Base_generateSupportRequestForSlapOS(\n
return context.HostingSubscription_createSupportRequestEvent(\n
"Hosting
Subscription
%s
is
partially
allocated"
%
hs_title,\n
failing_instance, \'slapos-crm-hosting-subscription-instance-allocation.notification\')\n
"%s
has
allocated
instance(s)
but,
the
instance
%s
(%s)
has
been
unallocated
for
more
than
4
hours."
%
(\n
\n
hs_title,
failing_instance.getTitle(),
failing_instance.getAbsoluteUrl()),\n
return\n
hosting_subscription.getRelativeUrl())\n
else:\n
return\n
]]>
</string>
</value>
]]>
</string>
</value>
...
@@ -104,7 +111,7 @@ else:\n
...
@@ -104,7 +111,7 @@ else:\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
HostingSubscription_checkSof
wareInstanceAllocation
State
</string>
</value>
<value>
<string>
HostingSubscription_checkSof
twareInstance
State
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/HostingSubscription_createSupportRequestEvent.xml
0 → 100644
View file @
bebf7b6a
<?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
\n
ticket_title = "Hosting Subscription %s is failing." % context.getTitle()\n
\n
description = "%s contains software instances which are unallocated or reporting errors." % (\n
context.getTitle())\n
\n
support_request = context.Base_generateSupportRequestForSlapOS(\n
ticket_title,\n
description,\n
context.getRelativeUrl())\n
\n
if support_request is None:\n
return\n
\n
person = context.getDestinationSectionValue(portal_type="Person")\n
if not person:\n
return\n
\n
if support_request.getSimulationState() != "validated":\n
support_request.validate()\n
\n
# Send Notification message\n
message = description\n
\n
notification_reference = notification_message_reference\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=notification_reference)\n
if notification_message is not None:\n
mapping_dict = {\'hosting_subscription_title\':context.getTitle(),\n
\'instance\': instance.getTitle()}\n
\n
message = notification_message.asText(\n
substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
\n
return support_request.SupportRequest_trySendNotificationMessage(\n
ticket_title, message, person.getRelativeUrl())\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
instance, notification_message_reference
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
HostingSubscription_createSupportRequestEvent
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Person_isServiceProvider.xml
View file @
bebf7b6a
...
@@ -54,7 +54,8 @@
...
@@ -54,7 +54,8 @@
return True\n
return True\n
\n
\n
for assignment in context.contentValues(portal_type="Assignment"):\n
for assignment in context.contentValues(portal_type="Assignment"):\n
if assignment.getRole() == \'service_provider\':\n
if assignment.getValidationState() == "open" and \\\n
assignment.getRole() == \'service_provider\':\n
return True\n
return True\n
\n
\n
return False\n
return False\n
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
HostingSubscription_CheckInstanceState
.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
SoftwareInstallation_hasReportedError
.xml
View file @
bebf7b6a
...
@@ -50,20 +50,28 @@
...
@@ -50,20 +50,28 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
hosting_subscription = context\n
<value>
<string>
from DateTime import DateTime\n
import json\n
\n
\n
instance = hosting_subscription.getPredecessorValue()\n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
if instance is None:\n
key_prefix=\'slap_tool\',\n
return\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
instance_list = [instance]\n
instance_list.extend(instance.getPredecessorValueList())\n
\n
\n
for sub_instance in instance_list:\n
try:\n
if sub_instance and \\\n
d = memcached_dict[context.getReference()]\n
sub_instance.activate().SoftwareInstance_checkState():\n
except KeyError:\n
# This instance is in failing state\n
# Information not available\n
# One notification per hosting subscription\n
return None\n
break\n
\n
d = json.loads(d)\n
result = d[\'text\']\n
last_contact = DateTime(d.get(\'created_at\'))\n
\n
# Optimise by checking memcache information first.\n
if result.startswith(\'#error \'):\n
return last_contact\n
\n
return None\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -72,7 +80,7 @@ for sub_instance in instance_list:\n
...
@@ -72,7 +80,7 @@ for sub_instance in instance_list:\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
HostingSubscription_CheckInstanceState
</string>
</value>
<value>
<string>
SoftwareInstallation_hasReportedError
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_checkState.xml
deleted
100644 → 0
View file @
339fba9c
<?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[
from DateTime import DateTime\n
import json\n
\n
portal = context.getPortalObject()\n
\n
if portal.ERP5Site_isSupportRequestCreationClosed():\n
# Stop ticket creation\n
return\n
\n
if (DateTime() - context.getCreationDate()) < 2:\n
# Ignore recently created instances.\n
return\n
\n
reference = context.getReference()\n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
key_prefix=\'slap_tool\',\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
\n
try:\n
d = memcached_dict[reference]\n
except KeyError:\n
return\n
\n
d = json.loads(d)\n
result = d[\'text\']\n
last_contact = DateTime(d.get(\'created_at\'))\n
\n
# Optimise by checking memcache information first.\n
if result.startswith(\'#error \'):\n
service = context.getSpecialiseValue(portal_type=\'Hosting Subscription\')\n
hosting_title = service.getTitle()\n
ticket_title = "Service %s in error state" % service.getReference()\n
description = "The instance %s of service %s has been in error state (last contact date: %s)" % (\n
reference, hosting_title, last_contact)\n
support_request_url = context.Base_generateSupportRequestForSlapOS(\n
ticket_title, description, service.getRelativeUrl())\n
\n
if not support_request_url:\n
return\n
\n
support_request = portal.restrictedTraverse(support_request_url, None)\n
person_url = service.getDestinationSection()\n
\n
if support_request is None or not person_url:\n
return support_request_url\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=\'slapos-crm-hosting_subscription_state.notification\')\n
if notification_message is None:\n
message = """Dear user,\n
%s.\n
Do not hesitate to visit the web forum (http://community.slapos.org/forum) in case of question.\n
\n
Regards,\n
\n
The slapos team""" % description\n
else:\n
mapping_dict = {\'hosting_title\':hosting_title,\n
\'hosting_url\':service.getRelativeUrl(),\n
\'instance_title\':context.getTitle(),\n
\'last_contact\':last_contact}\n
message = notification_message.asText(\n
substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
\n
support_request.SupportRequest_trySendNotificationMessage(\n
ticket_title, message, person_url, 0)\n
\n
return support_request_url\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SoftwareInstance_checkState
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
Computer_checkSoftwareInstanceState
.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
SoftwareInstance_hasReportedError
.xml
View file @
bebf7b6a
...
@@ -50,25 +50,30 @@
...
@@ -50,25 +50,30 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
<value>
<string>
from DateTime import DateTime\n
import json\n
\n
\n
partition_list = portal.portal_catalog(portal_type = \'Computer Partition\',\n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
free_for_request = 0,\n
key_prefix=\'slap_tool\',\n
parent_uid = context.getUid()\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
)\n
\n
\n
hosting_subscription_list = []\n
if context.getAggregateValue(portal_type="Computer Partition") is not None:\n
for partition in partition_list:\n
try:\n
software_instance = partition.getAggregateRelatedValue(\n
d = memcached_dict[context.getReference()]\n
portal_type=\'Software Instance\')\n
except KeyError:\n
if software_instance:\n
return \n
hosting = software_instance.getSpecialiseValue(\n
\n
portal_type=\'Hosting Subscription\')\n
d = json.loads(d)\n
if hosting and not hosting in hosting_subscription_list:\n
result = d[\'text\']\n
hosting_subscription_list.append(hosting)\n
last_contact = DateTime(d.get(\'created_at\'))\n
hosting.HostingSubscription_CheckInstanceState()\n
\n
\n
# Optimise by checking memcache information first.\n
return len(hosting_subscription_list)\n
if result.startswith(\'#error \'):\n
return last_contact\n
\n
# XXX time limit of 48 hours for run at least once.\n
\n
return None\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -77,7 +82,7 @@ return len(hosting_subscription_list)\n
...
@@ -77,7 +82,7 @@ return len(hosting_subscription_list)\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_checkSoftwareInstanceState
</string>
</value>
<value>
<string>
SoftwareInstance_hasReportedError
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_trySendNotificationMessage.xml
View file @
bebf7b6a
...
@@ -50,23 +50,23 @@
...
@@ -50,23 +50,23 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string>
support_request = context\n
support_request = context\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
resource = portal.service_module.slapos_crm_information.getRelativeUrl()\n
resource = portal.service_module.slapos_crm_information.getRelativeUrl()\n
# create Web message if needed for this ticket\n
# create Web message if needed for this ticket\n
last_event = context.portal_catalog.getResultValue(\n
last_event = context.portal_catalog.getResultValue(\n
title=message_title,\n
follow_up_uid=support_request.getUid(), \n
follow_up_uid=support_request.getUid(), \n
sort_on=[(\'delivery.start_date\', \'DESC\')],\n
sort_on=[(\'delivery.start_date\', \'DESC\')],\n
)\n
)\n
if last_event
and (interval_of_day >
0) and \\
\n
if last_event
:
\n
(DateTime() - last_event.getStartDate()
< interval_of_day
):
\n
# User has already been notified for this problem.
\n
#
User
has
already
been
notified
this
last
24h.
\n
return last_event
\n
return
\n
\n
event = portal.event_module.slapos_crm_web_message_template.\\\n
event = portal.event_module.slapos_crm_web_message_template.\\\n
Base_createCloneDocument(batch_mode=1)\n
Base_createCloneDocument(batch_mode=1)\n
\n
event.edit(\n
event.edit(\n
title=message_title,\n
title=message_title,\n
text_content=message,\n
text_content=message,\n
...
@@ -78,14 +78,14 @@ event.edit(\n
...
@@ -78,14 +78,14 @@ event.edit(\n
event.stop()\n
event.stop()\n
event.deliver()\n
event.deliver()\n
\n
\n
event.immediateReindexObject()\n
\n
return event\n
return event\n
</string>
</value>
]]
></string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
message_title, message, source_relative_url
, interval_of_day=1
</string>
</value>
<value>
<string>
message_title, message, source_relative_url
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
bebf7b6a
This diff is collapsed.
Click to expand it.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
View file @
bebf7b6a
...
@@ -6,10 +6,22 @@
...
@@ -6,10 +6,22 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSCRMAlarm
</string>
</value>
<value>
<string>
testSlapOSCRMAlarm
</string>
</value>
</item>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSCRMAlarm
</string>
</value>
<value>
<string>
test.erp5.testSlapOSCRMAlarm
</string>
</value>
...
@@ -43,13 +55,28 @@
...
@@ -43,13 +55,28 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -62,7 +89,7 @@
...
@@ -62,7 +89,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -71,7 +98,7 @@
...
@@ -71,7 +98,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
bebf7b6a
This diff is collapsed.
Click to expand it.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.xml
View file @
bebf7b6a
...
@@ -6,10 +6,22 @@
...
@@ -6,10 +6,22 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSCRMSkins
</string>
</value>
<value>
<string>
testSlapOSCRMSkins
</string>
</value>
</item>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSCRMSkins
</string>
</value>
<value>
<string>
test.erp5.testSlapOSCRMSkins
</string>
</value>
...
@@ -33,20 +45,7 @@
...
@@ -33,20 +45,7 @@
<item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple/>
<string>
W:206, 12: Unused variable \'event\' (unused-variable)
</string>
<string>
W:215, 4: Unused variable \'date\' (unused-variable)
</string>
<string>
W:1328, 4: Unused variable \'hosting_subscription\' (unused-variable)
</string>
<string>
W:1349, 4: Unused variable \'person\' (unused-variable)
</string>
<string>
W:1372, 4: Unused variable \'hosting_subscription\' (unused-variable)
</string>
<string>
W:1394, 4: Unused variable \'hosting_subscription\' (unused-variable)
</string>
<string>
W:1704, 4: Unused variable \'hosting_subscription\' (unused-variable)
</string>
<string>
W:1725, 4: Unused variable \'person\' (unused-variable)
</string>
<string>
W:1748, 4: Unused variable \'hosting_subscription\' (unused-variable)
</string>
<string>
W:1770, 4: Unused variable \'hosting_subscription\' (unused-variable)
</string>
<string>
W:1807, 2: Arguments number differs from overridden method (arguments-differ)
</string>
<string>
W:2033, 2: Arguments number differs from overridden method (arguments-differ)
</string>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
...
@@ -56,13 +55,28 @@
...
@@ -56,13 +55,28 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -75,7 +89,7 @@
...
@@ -75,7 +89,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -84,7 +98,7 @@
...
@@ -84,7 +98,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSupportRequestGeneration.py
deleted
100644 → 0
View file @
339fba9c
This diff is collapsed.
Click to expand it.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSupportRequestGeneration.xml
deleted
100644 → 0
View file @
339fba9c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSCRMSupportRequestGeneration
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSCRMSupportRequestGeneration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:108, 0: Bad indentation. Found 5 spaces, expected 4 (bad-indentation)
</string>
<string>
W:111, 0: Bad indentation. Found 5 spaces, expected 4 (bad-indentation)
</string>
<string>
W:117, 0: Bad indentation. Found 5 spaces, expected 4 (bad-indentation)
</string>
<string>
W:118, 0: Bad indentation. Found 5 spaces, expected 4 (bad-indentation)
</string>
<string>
W:120, 0: Bad indentation. Found 5 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 68, 2: Arguments number differs from overridden method (arguments-differ)
</string>
<string>
W: 95, 2: Arguments number differs from overridden method (arguments-differ)
</string>
<string>
W:895, 4: Unused variable \'software_installation\' (unused-variable)
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/bt/template_path_list
View file @
bebf7b6a
event_module/slapos_crm_web_message_template
event_module/slapos_crm_web_message_template
person_module/allocation_tester
person_module/allocation_tester
portal_alarms/slapos_check_computer_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_computer_state
portal_alarms/slapos_crm_check_instance_in_error
portal_alarms/slapos_crm_check_update_allocation_scope
portal_alarms/slapos_crm_check_update_allocation_scope
portal_alarms/slapos_crm_check_update_personal_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
...
...
master/bt5/slapos_crm/bt/template_test_id_list
View file @
bebf7b6a
test.erp5.testSlapOSCRMSkins
test.erp5.testSlapOSCRMSkins
test.erp5.testSlapOSCRMAlarm
test.erp5.testSlapOSCRMAlarm
test.erp5.testSlapOSCRMSupportRequestGeneration
\ No newline at end of file
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