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
Cédric Le Ninivin
slapos.core
Commits
5903206c
Commit
5903206c
authored
Dec 05, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cleanup_active_process alarm.
parent
1cf8dce7
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
174 additions
and
7 deletions
+174
-7
master/bt5/slapos_erp5/PathTemplateItem/portal_alarms/slapos_erp5_cleanup_active_process.xml
...Item/portal_alarms/slapos_erp5_cleanup_active_process.xml
+1
-1
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration.xml
...5/SkinTemplateItem/portal_skins/slapos_administration.xml
+47
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ActiveProcess_deleteSelf.xml
..._skins/slapos_administration/ActiveProcess_deleteSelf.xml
+7
-2
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_initiateActiveProcessCleanup.xml
...pos_administration/Alarm_initiateActiveProcessCleanup.xml
+0
-0
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5Alarm.py
...r/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5Alarm.py
+108
-0
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5SkinSelection.py
...apos_erp5/TestTemplateItem/testSlapOSERP5SkinSelection.py
+5
-0
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
master/bt5/slapos_erp5/bt/template_path_list
master/bt5/slapos_erp5/bt/template_path_list
+1
-0
master/bt5/slapos_erp5/bt/template_skin_id_list
master/bt5/slapos_erp5/bt/template_skin_id_list
+1
-0
master/bt5/slapos_erp5/bt/template_test_id_list
master/bt5/slapos_erp5/bt/template_test_id_list
+2
-1
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
master/bt5/vifib_slap/bt/template_path_list
master/bt5/vifib_slap/bt/template_path_list
+0
-1
No files found.
master/bt5/
vifib_slap/PathTemplateItem/portal_alarms/
cleanup_active_process.xml
→
master/bt5/
slapos_erp5/PathTemplateItem/portal_alarms/slapos_erp5_
cleanup_active_process.xml
View file @
5903206c
...
...
@@ -20,7 +20,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
cleanup_active_process
</string>
</value>
<value>
<string>
slapos_erp5_
cleanup_active_process
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration.xml
0 → 100644
View file @
5903206c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
business_template_skin_layer_priority
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
float
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
business_template_skin_layer_priority
</string>
</key>
<value>
<float>
60.0
</float>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_administration
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/
vifib_slap/SkinTemplateItem/portal_skins/vifib_slap
/ActiveProcess_deleteSelf.xml
→
master/bt5/
slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration
/ActiveProcess_deleteSelf.xml
View file @
5903206c
...
...
@@ -50,14 +50,19 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getPortalType() != \'Active Process\':\n
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getPortalType() != \'Active Process\':\n
raise TypeError(\'Call me on Active Process\')\n
\n
context.getParentValue().deleteContent(context.getId())\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/
vifib_slap/SkinTemplateItem/portal_skins/vifib_slap
/Alarm_initiateActiveProcessCleanup.xml
→
master/bt5/
slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration
/Alarm_initiateActiveProcessCleanup.xml
View file @
5903206c
File moved
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5Alarm.py
0 → 100644
View file @
5903206c
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.backportUnittest
import
skip
import
json
from
DateTime
import
DateTime
from
zExceptions
import
Unauthorized
class
TestSlapOSERP5CleanupActiveProcess
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
_simulateActiveProcess_deleteSelf
(
self
):
script_name
=
'ActiveProcess_deleteSelf'
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, **kwargs'
,
'# Script body
\
n
'
"""description = '%s
\
\
nVisited by ActiveProcess_deleteSelf' % context.getDescription()
context.edit(description=description)"""
)
transaction
.
commit
()
def
_dropActiveProcess_deleteSelf
(
self
):
script_name
=
'ActiveProcess_deleteSelf'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
check_cleanup_active_process_alarm
(
self
,
date
,
assert_method
):
def
verify_getCreationDate_call
(
*
args
,
**
kwargs
):
return
date
ActiveProcessClass
=
self
.
portal
.
portal_types
.
getPortalTypeClass
(
'Active Process'
)
ActiveProcessClass
.
getCreationDate_call
=
ActiveProcessClass
.
\
getCreationDate
ActiveProcessClass
.
getCreationDate
=
verify_getCreationDate_call
new_id
=
self
.
generateNewId
()
active_process
=
self
.
portal
.
portal_activities
.
newContent
(
portal_type
=
'Active Process'
,
title
=
"Active Process %s"
%
new_id
,
reference
=
"ACTPROC-%s"
%
new_id
,
description
=
"Active Process %s"
%
new_id
,
)
self
.
assertEquals
(
active_process
.
getCreationDate
(),
date
)
self
.
_simulateActiveProcess_deleteSelf
()
try
:
self
.
portal
.
portal_alarms
.
slapos_erp5_cleanup_active_process
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropActiveProcess_deleteSelf
()
self
.
portal
.
portal_types
.
resetDynamicDocumentsOnceAtTransactionBoundary
()
transaction
.
commit
()
assert_method
(
active_process
.
getDescription
(
''
).
\
endswith
(
"Visited by ActiveProcess_deleteSelf"
),
active_process
.
getDescription
(
''
))
def
test_alarm_old_active_process
(
self
):
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
22
,
self
.
assertTrue
)
def
test_alarm_new_active_process
(
self
):
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
20
,
self
.
assertFalse
)
class
TestSlapOSERP5ActiveProcess_deleteSelf
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
createActiveProcess
(
self
):
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
portal_activities
.
newContent
(
portal_type
=
'Active Process'
,
title
=
"Active Process %s"
%
new_id
,
reference
=
"ACTPROC-%s"
%
new_id
,
description
=
"Active Process %s"
%
new_id
,
)
def
test_disallowedPortalType
(
self
):
document
=
self
.
portal
.
person_module
.
newContent
()
self
.
assertRaises
(
TypeError
,
document
.
ActiveProcess_deleteSelf
,
)
def
test_REQUEST_disallowed
(
self
):
active_process
=
self
.
createActiveProcess
()
self
.
assertRaises
(
Unauthorized
,
active_process
.
ActiveProcess_deleteSelf
,
REQUEST
=
{})
def
test_default_use_case
(
self
):
active_process
=
self
.
createActiveProcess
()
module
=
active_process
.
getParentValue
()
id
=
active_process
.
getId
()
active_process
.
ActiveProcess_deleteSelf
()
self
.
assertRaises
(
KeyError
,
module
.
_getOb
,
id
)
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5SkinSelection.py
View file @
5903206c
...
...
@@ -109,6 +109,7 @@ class TestSlaposSkinSelection(testSlapOSMixin):
custom
vifib_hosting
slapos_accounting
slapos_administration
slapos_cache
slapos_cloud
slapos_cloud_promise
...
...
@@ -197,6 +198,7 @@ zpt_generic
"""
custom
slapos_accounting
slapos_administration
slapos_cache
slapos_cloud
slapos_cloud_promise
...
...
@@ -281,6 +283,7 @@ zpt_generic
"""
custom
slapos_accounting
slapos_administration
slapos_cache
slapos_cloud
slapos_cloud_promise
...
...
@@ -366,6 +369,7 @@ zpt_generic
"""
custom
slapos_accounting
slapos_administration
slapos_cache
slapos_cloud
slapos_cloud_promise
...
...
@@ -448,6 +452,7 @@ zpt_generic
"""
custom
slapos_accounting
slapos_administration
slapos_cache
slapos_cloud
slapos_cloud_promise
...
...
master/bt5/slapos_erp5/bt/revision
View file @
5903206c
115
\ No newline at end of file
116
\ No newline at end of file
master/bt5/slapos_erp5/bt/template_path_list
0 → 100644
View file @
5903206c
portal_alarms/slapos_erp5_cleanup_active_process
\ No newline at end of file
master/bt5/slapos_erp5/bt/template_skin_id_list
View file @
5903206c
slapos_administration
slapos_core
\ No newline at end of file
master/bt5/slapos_erp5/bt/template_test_id_list
View file @
5903206c
...
...
@@ -2,3 +2,4 @@ testSlapOSERP5DefaultScenario
testSlapOSERP5GroupRoleSecurity
testSlapOSERP5LocalPermissionSlapOSInteractionWorkflow
testSlapOSERP5SkinSelection
testSlapOSERP5Alarm
\ No newline at end of file
master/bt5/vifib_slap/bt/revision
View file @
5903206c
889
\ No newline at end of file
890
\ No newline at end of file
master/bt5/vifib_slap/bt/template_path_list
View file @
5903206c
portal_alarms/cleanup_active_process
portal_alarms/vifib_check_consistency
portal_alarms/vifib_lock_person
portal_alarms/vifib_lock_software_instance
...
...
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