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
Boxiang Sun
slapos.core
Commits
960a4068
Commit
960a4068
authored
Sep 12, 2013
by
Vivien Alger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support Request generation: Alarm_checkCloudIsFull refactoring
parent
06c32a51
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
957 additions
and
134 deletions
+957
-134
master/bt5/slapos_crm/PathTemplateItem/person_module/allocation_tester.xml
..._crm/PathTemplateItem/person_module/allocation_tester.xml
+160
-0
master/bt5/slapos_crm/PathTemplateItem/support_request_module/slapos_crm_support_request_template_for_monitoring.xml
...le/slapos_crm_support_request_template_for_monitoring.xml
+88
-0
master/bt5/slapos_crm/PropertySheetTemplateItem/portal_property_sheets/SlapOSCRMSystemPreference/preferred_software_release_to_test_for_space_property.xml
...preferred_software_release_to_test_for_space_property.xml
+46
-0
master/bt5/slapos_crm/PropertySheetTemplateItem/portal_property_sheets/SlapOSCRMSystemPreference/preferred_support_request_resource_for_monitoring_property.xml
...rred_support_request_resource_for_monitoring_property.xml
+46
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_checkCloudIsFull.xml
...teItem/portal_skins/slapos_crm/Alarm_checkCloudIsFull.xml
+13
-11
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Base_generateSupportRequestForSlapOS.xml
...skins/slapos_crm/Base_generateSupportRequestForSlapOS.xml
+91
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Computer_checkSoftwareInstanceState.xml
..._skins/slapos_crm/Computer_checkSoftwareInstanceState.xml
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Computer_checkState.xml
...plateItem/portal_skins/slapos_crm/Computer_checkState.xml
+18
-8
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SoftwareInstance_checkState.xml
...m/portal_skins/slapos_crm/SoftwareInstance_checkState.xml
+12
-8
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SoftwareRelease_testForAllocation.xml
...al_skins/slapos_crm/SoftwareRelease_testForAllocation.xml
+93
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SystemPreference_viewSlapOSCRM.xml
...ortal_skins/slapos_crm/SystemPreference_viewSlapOSCRM.xml
+2
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SystemPreference_viewSlapOSCRM/my_preferred_software_release_to_test_for_space.xml
...OSCRM/my_preferred_software_release_to_test_for_space.xml
+96
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SystemPreference_viewSlapOSCRM/my_preferred_support_request_resource_for_monitoring.xml
.../my_preferred_support_request_resource_for_monitoring.xml
+96
-0
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSupportRequestGeneration.py
...TestTemplateItem/testSlapOSCRMSupportRequestGeneration.py
+191
-104
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
+3
-1
No files found.
master/bt5/slapos_crm/PathTemplateItem/person_module/allocation_tester.xml
0 → 100644
View file @
960a4068
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Person"
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>
</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>
</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>
</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>
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</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>
default_reference
</string>
</key>
<value>
<string>
allocation_tester
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
first_name
</string>
</key>
<value>
<string>
Member
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
allocation_tester
</string>
</value>
</item>
<item>
<key>
<string>
last_name
</string>
</key>
<value>
<string>
Template
</string>
</value>
</item>
<item>
<key>
<string>
password
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAU=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Person
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Allocation tester
</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>
<record
id=
"5"
aka=
"AAAAAAAAAAU="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string>
{SSHA}f1gAG3A53rfwjkLB/+Ex89MtocZz/4V9K4TZ
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/PathTemplateItem/support_request_module/slapos_crm_support_request_template_for_monitoring.xml
0 → 100644
View file @
960a4068
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Support Request"
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>
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>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_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>
source_section/organisation_module/slapos
</string>
<string>
source_trade/organisation_module/slapos
</string>
<string>
source/organisation_module/slapos
</string>
<string>
resource/service_module/slapos_crm_monitoring
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SR-282
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_crm_support_request_template_for_monitoring
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Support Request
</string>
</value>
</item>
<item>
<key>
<string>
price
</string>
</key>
<value>
<float>
0.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Template Support Request For Monitoring
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/PropertySheetTemplateItem/portal_property_sheets/SlapOSCRMSystemPreference/preferred_software_release_to_test_for_space_property.xml
0 → 100644
View file @
960a4068
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_software_release_to_test_for_space_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<string>
python:\'\'
</string>
</value>
</item>
<item>
<key>
<string>
write_permission
</string>
</key>
<value>
<string>
Manage properties
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/PropertySheetTemplateItem/portal_property_sheets/SlapOSCRMSystemPreference/preferred_support_request_resource_for_monitoring_property.xml
0 → 100644
View file @
960a4068
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_support_request_resource_for_monitoring_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<string>
python:\'\'
</string>
</value>
</item>
<item>
<key>
<string>
write_permission
</string>
</key>
<value>
<string>
Manage properties
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_checkCloudIsFull.xml
View file @
960a4068
...
@@ -52,23 +52,25 @@
...
@@ -52,23 +52,25 @@
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
<value>
<string>
portal = context.getPortalObject()\n
\n
\n
computer_list = portal.portal_catalog(\n
software_release_preference = portal.portal_preferences.getPreferredSoftwareReleaseToTestForSpace()\n
portal_type=\'Computer\',\n
validation_state = \'validated\',\n
capacity_scope = \'open\',\n
limit = 1\n
)\n
\n
\n
if len(computer_list) == 0:\n
if software_release_preference != \'\':\n
context.activate(tag=tag).Base_generateSupportRequestForSlapOS(\n
software_release_list = software_release_preference.split("\\n")\n
"VIFIB public cloud is full",\n
\n
"No more computer with open capacity scope, add more ASAP"\n
portal.portal_catalog.searchAndActivate(\n
portal_type = \'Software Release\',\n
url_string = software_release_list,\n
\n
method_id = \'SoftwareRelease_testForAllocation\',\n
activate_kw = {\'tag\':tag} \n
)\n
)\n
\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>
<value>
<string>
*args, **kw
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Base_generateSupportRequestForSlapOS.xml
0 → 100644
View file @
960a4068
<?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
portal = context.getPortalObject()\n
\n
support_request_in_progress = portal.portal_catalog.getResultValue(\n
portal_type = \'Support Request\',\n
title = title,\n
simulation_state = ["validated","submitted","suspended"],\n
source_project_value = source_relative_url\n
)\n
\n
if support_request_in_progress is None:\n
support_request = portal.\\\n
support_request_module.\\\n
slapos_crm_support_request_template_for_monitoring.\\\n
Base_createCloneDocument(batch_mode=1)\n
support_request.edit(\n
title = title,\n
description = description,\n
start_date = DateTime(),\n
source_project_value = source_relative_url\n
)\n
support_request.validate()\n
\n
return support_request.getRelativeUrl()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, description, source_relative_url
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_generateSupportRequestForSlapOS
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Computer_checkSoftwareInstanceState.xml
View file @
960a4068
...
@@ -58,7 +58,7 @@ partition_list = portal.portal_catalog(portal_type = \'Computer Partition\',\n
...
@@ -58,7 +58,7 @@ partition_list = portal.portal_catalog(portal_type = \'Computer Partition\',\n
)\n
)\n
\n
\n
for partition in partition_list:\n
for partition in partition_list:\n
instance = partition.getAggregateRelatedValue()\n
instance = partition.getAggregateRelatedValue(
portal_type=\'Software Instance\'
)\n
if instance is not None:\n
if instance is not None:\n
instance.activate().SoftwareInstance_checkState()\n
instance.activate().SoftwareInstance_checkState()\n
</string>
</value>
</string>
</value>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Computer_checkState.xml
View file @
960a4068
...
@@ -53,18 +53,28 @@
...
@@ -53,18 +53,28 @@
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from DateTime import DateTime\n
from DateTime import DateTime\n
import json\n
\n
\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
last_contact = context.Computer_getLastestContactedDate()\n
reference = context.getReference()\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
\n
if last_contact != "Computer didn\'t contact the server":\n
d = json.loads(d)\n
if (DateTime() - last_contact) >
1:\n
last_contact = DateTime(d.get(\'created_at\'))\n
tag = "Support Request generation for %s" % reference\n
\n
context.activate(tag=tag).Base_generateSupportRequestForSlapOS(\n
if (DateTime() - last_contact) >
1:\n
"Support Request for %s" % reference,\n
return context.Base_generateSupportRequestForSlapOS(\n
"%s has not contacted the server for more than 24 hours" % reference\n
"Lost contact with %s" % reference,\n
"%s has not contacted the server for more than 24 hours (last contact date: %s)" % (reference, last_contact),\n
context.getRelativeUrl()\n
)\n
)\n
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SoftwareInstance_checkState.xml
View file @
960a4068
...
@@ -69,23 +69,27 @@ d = json.loads(d)\n
...
@@ -69,23 +69,27 @@ d = json.loads(d)\n
result = d[\'text\']\n
result = d[\'text\']\n
last_contact = DateTime(d.get(\'created_at\'))\n
last_contact = DateTime(d.get(\'created_at\'))\n
now = DateTime()\n
now = DateTime()\n
title = ""\n
\n
\n
if result.startswith(\'#error \'):\n
if result.startswith(\'#error \'):\n
# If no change in the last 2 hours generate a support request\n
# If no change in the last 2 hours generate a support request\n
if (now - last_contact) >
0.08:\n
if (now - last_contact) >
0.08:\n
tag = "Support Request generation for %s" % reference\n
tag = "Support Request generation for %s" % reference\n
context.activate(tag=tag).Base_generateSupportRequestForSlapOS(\n
title = "Instance %s in error state" % reference\n
"Support Request for %s" % reference,\n
description = "%s has been in error state for more than 2 hours (last contact date: %s)" % (reference, last_contact)\n
"%s has been in error state for more than 2 hours" % reference\n
)\n
\n
\n
elif result.startswith(\'#access \'):\n
elif result.startswith(\'#access \'):\n
# If there was no contact for more than one day generate a support request\n
# If there was no contact for more than one day generate a support request\n
if (now - last_contact) > 1:\n
if (now - last_contact) > 1:\n
tag = "Support Request generation for %s" % reference\n
tag = "Support Request generation for %s" % reference\n
context.activate(tag=tag).Base_generateSupportRequestForSlapOS(\n
title = "Instance %s in unknown state" % reference\n
"Support Request for %s" % reference,\n
description = "%s has not contacted the server for more than 24 hours (last contact date: %s)" % (reference, last_contact)\n
"%s has not contacted the server for more than 24 hours" % reference\n
\n
if title != "":\n
return context.Base_generateSupportRequestForSlapOS(\n
title,\n
description,\n
context.getRelativeUrl()\n
)\n
)\n
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SoftwareRelease_testForAllocation.xml
0 → 100644
View file @
960a4068
<?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
software_release = context\n
software_release_url = software_release.getUrlString()\n
\n
user = portal.person_module.allocation_tester\n
\n
result = user.Person_restrictMethodAsShadowUser(\n
shadow_document=user,\n
callable_object=user.Person_findPartition,\n
argument_list=[\n
software_release_url,\n
\'\',\n
\'Software Instance\',\n
{}\n
],\n
argument_dict={\n
\'test_mode\': True})\n
\n
if not result:\n
title = "Can\'t allocate new instances for software release %s" % software_release_url\n
description = "Need more public computers that can instanciate the software release %s" % software_release_url\n
\n
return software_release.Base_generateSupportRequestForSlapOS(\n
title,\n
description,\n
software_release.getRelativeUrl()\n
)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SoftwareRelease_testForAllocation
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SystemPreference_viewSlapOSCRM.xml
View file @
960a4068
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
<string>
my_preferred_support_request_template
</string>
<string>
my_preferred_support_request_template
</string>
<string>
my_preferred_web_message_template
</string>
<string>
my_preferred_web_message_template
</string>
<string>
my_preferred_slapos_web_site_url
</string>
<string>
my_preferred_slapos_web_site_url
</string>
<string>
my_preferred_support_request_resource_for_monitoring
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
@@ -106,6 +107,7 @@
...
@@ -106,6 +107,7 @@
<list>
<list>
<string>
my_preferred_regularisation_request_use_list
</string>
<string>
my_preferred_regularisation_request_use_list
</string>
<string>
my_preferred_regularisation_request_resource
</string>
<string>
my_preferred_regularisation_request_resource
</string>
<string>
my_preferred_software_release_to_test_for_space
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SystemPreference_viewSlapOSCRM/my_preferred_software_release_to_test_for_space.xml
0 → 100644
View file @
960a4068
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_preferred_software_release_to_test_for_space
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_text_area_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Software Release To Test For Space
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/SystemPreference_viewSlapOSCRM/my_preferred_support_request_resource_for_monitoring.xml
0 → 100644
View file @
960a4068
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_preferred_support_request_resource_for_monitoring
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_string_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Resource For Monitoring Support Request
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSupportRequestGeneration.py
View file @
960a4068
...
@@ -63,6 +63,33 @@ class TestSlapOSCloudSupportRequestGeneration(testSlapOSMixin):
...
@@ -63,6 +63,33 @@ class TestSlapOSCloudSupportRequestGeneration(testSlapOSMixin):
p
.
markFree
()
p
.
markFree
()
p
.
validate
()
p
.
validate
()
def
_makeSoftwareRelease
(
self
,
new_id
,
software_release_url
=
None
):
software_release
=
self
.
portal
.
software_release_module
\
.
template_software_release
.
Base_createCloneDocument
(
batch_mode
=
1
)
software_release
.
edit
(
url_string
=
software_release_url
or
self
.
generateNewSoftwareReleaseUrl
(),
reference
=
'TESTSOFTRELS-%s'
%
new_id
,
title
=
'Start requested for %s'
%
new_id
)
software_release
.
release
()
return
software_release
def
_makeSoftwareInstallation
(
self
,
new_id
,
computer
,
software_release_url
):
software_installation
=
self
.
portal
\
.
software_installation_module
.
template_software_installation
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
software_installation
.
edit
(
url_string
=
software_release_url
,
aggregate
=
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINSTS-%s'
%
new_id
,
title
=
'Start requested for %s'
%
computer
.
getUid
()
)
software_installation
.
validate
()
software_installation
.
requestStart
()
return
software_installation
def
_makeHostingSubscription
(
self
,
new_id
):
def
_makeHostingSubscription
(
self
,
new_id
):
hosting_subscription
=
self
.
portal
\
hosting_subscription
=
self
.
portal
\
.
hosting_subscription_module
.
template_hosting_subscription
\
.
hosting_subscription_module
.
template_hosting_subscription
\
...
@@ -92,64 +119,45 @@ class TestSlapOSCloudSupportRequestGeneration(testSlapOSMixin):
...
@@ -92,64 +119,45 @@ class TestSlapOSCloudSupportRequestGeneration(testSlapOSMixin):
def
test_Base_generateSupportRequestForSlapOS
(
self
):
def
test_Base_generateSupportRequestForSlapOS
(
self
):
title
=
"Test Support Request %s"
%
self
.
new_id
title
=
"Test Support Request %s"
%
self
.
new_id
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
)
support_request
=
computer
.
Base_generateSupportRequestForSlapOS
(
self
.
tic
()
title
,
title
,
computer
.
getRelativeUrl
()
support_request
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Support Request'
,
title
=
title
,
simulation_state
=
[
"validated"
,
"submitted"
,
"suspended"
]
)
)
self
.
tic
()
self
.
assertNotEqual
(
support_request
,
None
)
self
.
assertNotEqual
(
support_request
,
None
)
def
test_Base_generateSupportRequestForSlapOS_do_not_recreate_if_open
(
self
):
def
test_Base_generateSupportRequestForSlapOS_do_not_recreate_if_open
(
self
):
title
=
"Test Support Request %s"
%
self
.
new_id
title
=
"Test Support Request %s"
%
self
.
new_id
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
)
computer
.
Base_generateSupportRequestForSlapOS
(
self
.
tic
()
title
,
title
,
computer
.
getRelativeUrl
()
)
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
)
self
.
tic
()
self
.
tic
()
support_request_list
=
self
.
portal
.
portal_catalog
(
support_request
=
computer
.
Base_generateSupportRequestForSlapOS
(
portal_type
=
'Support Request'
,
title
,
title
,
computer
.
getRelativeUrl
()
title
=
title
,
simulation_state
=
[
"validated"
,
"submitted"
,
"suspended"
]
)
)
self
.
tic
()
self
.
assertEqual
(
len
(
support_request_list
),
1
)
self
.
assertEqual
(
support_request
,
None
)
def
test_Base_generateSupportRequestForSlapOS_recreate_if_closed
(
self
):
def
test_Base_generateSupportRequestForSlapOS_recreate_if_closed
(
self
):
title
=
"Test Support Request %s"
%
self
.
new_id
title
=
"Test Support Request %s"
%
self
.
new_id
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
)
support_request
=
computer
.
Base_generateSupportRequestForSlapOS
(
self
.
tic
()
title
,
title
,
computer
.
getRelativeUrl
()
support_request
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Support Request'
,
title
=
title
,
simulation_state
=
[
"validated"
,
"submitted"
,
"suspended"
]
)
)
support_request
.
invalidate
()
self
.
tic
()
self
.
tic
()
computer
.
Base_generateSupportRequestForSlapOS
(
title
,
title
)
self
.
portal
.
restrictedTraverse
(
support_request
).
invalidate
(
)
self
.
tic
()
self
.
tic
()
support_request_list
=
self
.
portal
.
portal_catalog
(
support_request
=
computer
.
Base_generateSupportRequestForSlapOS
(
portal_type
=
'Support Request'
,
title
,
title
,
computer
.
getRelativeUrl
()
title
=
title
)
self
.
assertEqual
(
len
(
support_request_list
),
2
)
support_request_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Support Request'
,
title
=
title
,
simulation_state
=
[
"validated"
,
"submitted"
,
"suspended"
]
)
)
self
.
tic
()
self
.
assert
Equal
(
len
(
support_request_list
),
1
)
self
.
assert
NotEqual
(
support_request
,
None
)
def
_simulateBase_generateSupportRequestForSlapOS
(
self
):
def
_simulateBase_generateSupportRequestForSlapOS
(
self
):
script_name
=
'Base_generateSupportRequestForSlapOS'
script_name
=
'Base_generateSupportRequestForSlapOS'
...
@@ -159,8 +167,7 @@ class TestSlapOSCloudSupportRequestGeneration(testSlapOSMixin):
...
@@ -159,8 +167,7 @@ class TestSlapOSCloudSupportRequestGeneration(testSlapOSMixin):
script_name
,
script_name
,
'*args, **kw'
,
'*args, **kw'
,
'# Script body
\
n
'
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
"""return 'Visited Base_generateSupportRequestForSlapOS'"""
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Base_generateSupportRequestForSlapOS') """
)
transaction
.
commit
()
transaction
.
commit
()
def
_dropBase_generateSupportRequestForSlapOS
(
self
):
def
_dropBase_generateSupportRequestForSlapOS
(
self
):
...
@@ -169,39 +176,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by B
...
@@ -169,39 +176,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by B
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
transaction
.
commit
()
def
_simulateComputer_getLastestContactedDate
(
self
):
script_name
=
'Computer_getLastestContactedDate'
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
'
"""from DateTime import DateTime
import json
portal = context.getPortalObject()
# Check if computer has error reported
memcached_dict = portal.portal_memcached.getMemcachedDict(
key_prefix='slap_tool',
plugin_path='portal_memcached/default_memcached_plugin')
try:
d = memcached_dict[context.getReference()]
except KeyError:
return "Computer didn't contact the server"
log_dict = json.loads(d)
return DateTime(log_dict.get('created_at'))"""
)
transaction
.
commit
()
def
_dropComputer_getLastestContactedDate
(
self
):
script_name
=
'Computer_getLastestContactedDate'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_Computer_checkState
(
self
):
def
test_Computer_checkState
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
...
@@ -213,33 +187,27 @@ return DateTime(log_dict.get('created_at'))""")
...
@@ -213,33 +187,27 @@ return DateTime(log_dict.get('created_at'))""")
)
)
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateComputer_getLastestContactedDate
()
try
:
try
:
computer
.
Computer_checkState
()
result
=
computer
.
Computer_checkState
()
self
.
tic
()
finally
:
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropComputer_getLastestContactedDate
()
self
.
assertEqual
(
'Visited
by
Base_generateSupportRequestForSlapOS'
,
self
.
assertEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
result
)
def
test_Computer_checkState_empty_cache
(
self
):
def
test_Computer_checkState_empty_cache
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateComputer_getLastestContactedDate
()
try
:
try
:
computer
.
Computer_checkState
()
result
=
computer
.
Computer_checkState
()
self
.
tic
()
finally
:
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropComputer_getLastestContactedDate
()
self
.
assertNotEqual
(
'Visited
by
Base_generateSupportRequestForSlapOS'
,
self
.
assertNotEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
result
)
def
test_SoftwareInstance_checkState_error_out_time
(
self
):
def
test_SoftwareInstance_checkState_error_out_time
(
self
):
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
...
@@ -257,13 +225,12 @@ return DateTime(log_dict.get('created_at'))""")
...
@@ -257,13 +225,12 @@ return DateTime(log_dict.get('created_at'))""")
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
try
:
instance
.
SoftwareInstance_checkState
()
result
=
instance
.
SoftwareInstance_checkState
()
self
.
tic
()
finally
:
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertEqual
(
'Visited
by
Base_generateSupportRequestForSlapOS'
,
self
.
assertEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
result
)
def
test_SoftwareInstance_checkState_error_in_time
(
self
):
def
test_SoftwareInstance_checkState_error_in_time
(
self
):
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
...
@@ -281,13 +248,12 @@ return DateTime(log_dict.get('created_at'))""")
...
@@ -281,13 +248,12 @@ return DateTime(log_dict.get('created_at'))""")
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
try
:
instance
.
SoftwareInstance_checkState
()
result
=
instance
.
SoftwareInstance_checkState
()
self
.
tic
()
finally
:
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertNotEqual
(
'Visited
by
Base_generateSupportRequestForSlapOS'
,
self
.
assertNotEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
result
)
def
test_SoftwareInstance_checkState_access_out_time
(
self
):
def
test_SoftwareInstance_checkState_access_out_time
(
self
):
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
...
@@ -305,13 +271,12 @@ return DateTime(log_dict.get('created_at'))""")
...
@@ -305,13 +271,12 @@ return DateTime(log_dict.get('created_at'))""")
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
try
:
instance
.
SoftwareInstance_checkState
()
result
=
instance
.
SoftwareInstance_checkState
()
self
.
tic
()
finally
:
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertEqual
(
'Visited
by
Base_generateSupportRequestForSlapOS'
,
self
.
assertEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
result
)
def
test_SoftwareInstance_checkState_access_in_time
(
self
):
def
test_SoftwareInstance_checkState_access_in_time
(
self
):
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
...
@@ -329,13 +294,12 @@ return DateTime(log_dict.get('created_at'))""")
...
@@ -329,13 +294,12 @@ return DateTime(log_dict.get('created_at'))""")
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
try
:
instance
.
SoftwareInstance_checkState
()
result
=
instance
.
SoftwareInstance_checkState
()
self
.
tic
()
finally
:
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertNotEqual
(
'Visited
by
Base_generateSupportRequestForSlapOS'
,
self
.
assertNotEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
result
)
def
test_SoftwareInstance_checkState_empty_cache
(
self
):
def
test_SoftwareInstance_checkState_empty_cache
(
self
):
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
host_sub
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
...
@@ -345,13 +309,98 @@ return DateTime(log_dict.get('created_at'))""")
...
@@ -345,13 +309,98 @@ return DateTime(log_dict.get('created_at'))""")
self
.
_simulateBase_generateSupportRequestForSlapOS
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
try
:
instance
.
SoftwareInstance_checkState
()
result
=
instance
.
SoftwareInstance_checkState
()
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertNotEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
result
)
def
test_SoftwareRelease_testForAllocation
(
self
):
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
,
capacity_scope
=
'open'
)
self
.
_makeComputerPartitions
(
computer
)
self
.
_makeSoftwareInstallation
(
self
.
new_id
,
computer
,
software_release
.
getUrlString
()
)
self
.
tic
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
result
=
software_release
.
SoftwareRelease_testForAllocation
()
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertNotEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
result
)
def
test_SoftwareRelease_testForAllocation_no_public_computer
(
self
):
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
capacity_scope
=
'open'
)
self
.
_makeComputerPartitions
(
computer
)
self
.
_makeSoftwareInstallation
(
self
.
new_id
,
computer
,
software_release
.
getUrlString
()
)
self
.
tic
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
result
=
software_release
.
SoftwareRelease_testForAllocation
()
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
result
)
def
test_SoftwareRelease_testForAllocation_no_open_computer
(
self
):
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
self
.
_makeComputerPartitions
(
computer
)
self
.
_makeSoftwareInstallation
(
self
.
new_id
,
computer
,
software_release
.
getUrlString
()
)
self
.
tic
()
self
.
tic
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
result
=
software_release
.
SoftwareRelease_testForAllocation
()
finally
:
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertNotEqual
(
'Visited by Base_generateSupportRequestForSlapOS'
,
self
.
assertEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
result
)
def
test_SoftwareRelease_testForAllocation_no_free_partitions
(
self
):
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
,
capacity_scope
=
'open'
)
self
.
_makeComputerPartitions
(
computer
)
computer
.
partition1
.
markBusy
()
computer
.
partition2
.
markBusy
()
computer
.
partition3
.
markBusy
()
computer
.
partition4
.
markBusy
()
self
.
_makeSoftwareInstallation
(
self
.
new_id
,
computer
,
software_release
.
getUrlString
()
)
self
.
tic
()
self
.
_simulateBase_generateSupportRequestForSlapOS
()
try
:
result
=
software_release
.
SoftwareRelease_testForAllocation
()
finally
:
self
.
_dropBase_generateSupportRequestForSlapOS
()
self
.
assertEqual
(
'Visited Base_generateSupportRequestForSlapOS'
,
result
)
def
_simulateSoftwareInstance_checkState
(
self
):
def
_simulateSoftwareInstance_checkState
(
self
):
script_name
=
'SoftwareInstance_checkState'
script_name
=
'SoftwareInstance_checkState'
...
@@ -501,3 +550,41 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -501,3 +550,41 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstanceState'
,
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstanceState'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulateSoftwareRelease_testForAllocation
(
self
):
script_name
=
'SoftwareRelease_testForAllocation'
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='Visited by SoftwareRelease_testForAllocation') """
)
transaction
.
commit
()
def
_dropSoftwareRelease_testForAllocation
(
self
):
script_name
=
'SoftwareRelease_testForAllocation'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_Alarm_checkCloudIsFull
(
self
):
software_release_preference
=
self
.
portal
.
portal_preferences
.
getPreferredSoftwareReleaseToTestForSpace
()
if
software_release_preference
!=
''
:
software_release_list
=
software_release_preference
.
split
(
"
\
n
"
)
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
,
software_release_list
[
0
])
self
.
_simulateSoftwareRelease_testForAllocation
()
try
:
self
.
portal
.
portal_alarms
.
slapos_check_cloud_is_full
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropSoftwareRelease_testForAllocation
()
self
.
assertEqual
(
'Visited by SoftwareRelease_testForAllocation'
,
software_release
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
master/bt5/slapos_crm/bt/revision
View file @
960a4068
22
23
\ No newline at end of file
\ No newline at end of file
master/bt5/slapos_crm/bt/template_path_list
View file @
960a4068
event_module/slapos_crm_web_message_template
event_module/slapos_crm_web_message_template
person_module/allocation_tester
portal_alarms/slapos_check_cloud_is_full
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
...
@@ -22,3 +23,4 @@ service_module/slapos_crm_spam
...
@@ -22,3 +23,4 @@ service_module/slapos_crm_spam
service_module/slapos_crm_stop_acknowledgement
service_module/slapos_crm_stop_acknowledgement
service_module/slapos_crm_stop_reminder
service_module/slapos_crm_stop_reminder
support_request_module/slapos_crm_support_request_template
support_request_module/slapos_crm_support_request_template
support_request_module/slapos_crm_support_request_template_for_monitoring
\ 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