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
Ophélie Gagnard
slapos.core
Commits
34bf4cba
Commit
34bf4cba
authored
Sep 16, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
New constraints from Admin alarms
See merge request
nexedi/slapos.core!420
parents
1bf8c5a0
015f2b24
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
314 additions
and
315 deletions
+314
-315
master/bt5/slapos_cloud/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+6
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SlapOSReferenceConstraint.xml
...Item/portal_property_sheets/SlapOSReferenceConstraint.xml
+66
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SlapOSReferenceConstraint/reference_not_empty_constraint.xml
...pOSReferenceConstraint/reference_not_empty_constraint.xml
+0
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SlapOSReferenceConstraint/reference_unicity_constraint.xml
...lapOSReferenceConstraint/reference_unicity_constraint.xml
+1
-1
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceDuplicationConstraint.xml
...property_sheets/SoftwareInstanceDuplicationConstraint.xml
+66
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceDuplicationConstraint/duplication_instance_on_instance_tree_constraint_constraint.xml
...ation_instance_on_instance_tree_constraint_constraint.xml
+80
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency.py
...wareInstance_checkDuplicationOnInstanceTreeConsistency.py
+20
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency.xml
...areInstance_checkDuplicationOnInstanceTreeConsistency.xml
+2
-2
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudConstraint.py
.../portal_components/test.erp5.testSlapOSCloudConstraint.py
+61
-25
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudConstraint.xml
...portal_components/test.erp5.testSlapOSCloudConstraint.xml
+3
-24
master/bt5/slapos_cloud/bt/template_portal_type_property_sheet_list
.../slapos_cloud/bt/template_portal_type_property_sheet_list
+6
-0
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
+3
-1
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedObjectReference.py
...s_administration/Alarm_searchDuplicatedObjectReference.py
+0
-12
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedObjectReference.xml
..._administration/Alarm_searchDuplicatedObjectReference.xml
+0
-62
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.py
..._administration/Alarm_searchDuplicatedSoftwareInstance.py
+0
-8
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.xml
...administration/Alarm_searchDuplicatedSoftwareInstance.xml
+0
-62
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Base_checkDuplicatedReference.py
...ns/slapos_administration/Base_checkDuplicatedReference.py
+0
-15
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/InstanceTree_checkDuplicatedInstance.py
...os_administration/InstanceTree_checkDuplicatedInstance.py
+0
-40
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/InstanceTree_checkDuplicatedInstance.xml
...s_administration/InstanceTree_checkDuplicatedInstance.xml
+0
-62
master/bt5/slapos_erp5/bt/template_path_list
master/bt5/slapos_erp5/bt/template_path_list
+0
-1
No files found.
master/bt5/slapos_cloud/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
34bf4cba
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<item>
ComputeNodeSlapOSMetadata
</item>
<item>
ComputeNodeSlapOSMetadata
</item>
<item>
ComputerUpgradeConstraint
</item>
<item>
ComputerUpgradeConstraint
</item>
<item>
ERP5User
</item>
<item>
ERP5User
</item>
<item>
SlapOSReferenceConstraint
</item>
<item>
SlaposCapacity
</item>
<item>
SlaposCapacity
</item>
<item>
SlaposComputeNodeConstraint
</item>
<item>
SlaposComputeNodeConstraint
</item>
<item>
Url
</item>
<item>
Url
</item>
...
@@ -49,13 +50,16 @@
...
@@ -49,13 +50,16 @@
<portal_type
id=
"Slave Instance"
>
<portal_type
id=
"Slave Instance"
>
<item>
InstanceTree
</item>
<item>
InstanceTree
</item>
<item>
Reference
</item>
<item>
Reference
</item>
<item>
SlapOSReferenceConstraint
</item>
<item>
SlaveInstanceConstraint
</item>
<item>
SlaveInstanceConstraint
</item>
<item>
SoftwareInstance
</item>
<item>
SoftwareInstance
</item>
<item>
SoftwareInstanceDuplicationConstraint
</item>
<item>
TextDocument
</item>
<item>
TextDocument
</item>
<item>
Url
</item>
<item>
Url
</item>
<item>
VariationRange
</item>
<item>
VariationRange
</item>
</portal_type>
</portal_type>
<portal_type
id=
"Software Installation"
>
<portal_type
id=
"Software Installation"
>
<item>
SlapOSReferenceConstraint
</item>
<item>
Url
</item>
<item>
Url
</item>
<item>
VariationRange
</item>
<item>
VariationRange
</item>
</portal_type>
</portal_type>
...
@@ -63,8 +67,10 @@
...
@@ -63,8 +67,10 @@
<item>
ERP5User
</item>
<item>
ERP5User
</item>
<item>
InstanceTree
</item>
<item>
InstanceTree
</item>
<item>
Reference
</item>
<item>
Reference
</item>
<item>
SlapOSReferenceConstraint
</item>
<item>
SoftwareInstance
</item>
<item>
SoftwareInstance
</item>
<item>
SoftwareInstanceConstraint
</item>
<item>
SoftwareInstanceConstraint
</item>
<item>
SoftwareInstanceDuplicationConstraint
</item>
<item>
SoftwareInstanceUpgradeConstraint
</item>
<item>
SoftwareInstanceUpgradeConstraint
</item>
<item>
TextDocument
</item>
<item>
TextDocument
</item>
<item>
Url
</item>
<item>
Url
</item>
...
...
master/bt5/slapos_
erp5/PathTemplateItem/portal_alarms/slapos_check_duplicated_software_instance
.xml
→
master/bt5/slapos_
cloud/PropertySheetTemplateItem/portal_property_sheets/SlapOSReferenceConstraint
.xml
View file @
34bf4cba
...
@@ -2,54 +2,65 @@
...
@@ -2,54 +2,65 @@
<ZopeData>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<pickle>
<global
name=
"
Alarm
"
module=
"erp5.portal_type"
/>
<global
name=
"
Property Sheet
"
module=
"erp5.portal_type"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<key>
<string>
_count
</string>
</key>
<value>
<string>
Alarm_searchDuplicatedSoftwareInstance
</string>
</value>
<value>
</item>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
<item>
</value>
<key>
<string>
description
</string>
</key>
<value>
<string>
Search for Duplicated Software Instance on a Single Instance Tree
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
_mt_index
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
_tree
</string>
</key>
<value>
<string>
slapos_check_duplicated_software_instance
</string>
</value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
<none/>
</tuple>
<state>
<tuple>
<float>
433814400.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
<value>
<string>
SlapOSReferenceConstraint
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
titl
e
</string>
</key>
<key>
<string>
portal_typ
e
</string>
</key>
<value>
<string>
Search Duplicated Software Instances
</string>
</value>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</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>
</ZopeData>
</ZopeData>
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/Slap
osComputeNod
eConstraint/reference_not_empty_constraint.xml
→
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/Slap
OSReferenc
eConstraint/reference_not_empty_constraint.xml
View file @
34bf4cba
File moved
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/Slap
osComputeNod
eConstraint/reference_unicity_constraint.xml
→
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/Slap
OSReferenc
eConstraint/reference_unicity_constraint.xml
View file @
34bf4cba
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
filter_parameter
</string>
</key>
<key>
<string>
filter_parameter
</string>
</key>
<value>
<string>
python: {\'portal_type\': (object.getPortalType(),
\'Person\'
), \'reference\': object.getReference()}
</string>
</value>
<value>
<string>
python: {\'portal_type\': (object.getPortalType(), ), \'reference\': object.getReference()}
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceDuplicationConstraint.xml
0 → 100644
View file @
34bf4cba
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<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>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SoftwareInstanceDuplicationConstraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</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>
</ZopeData>
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceDuplicationConstraint/duplication_instance_on_instance_tree_constraint_constraint.xml
0 → 100644
View file @
34bf4cba
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Script Constraint"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
constraint_type/default
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
duplication_instance_on_instance_tree_constraint_constraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Script Constraint
</string>
</value>
</item>
<item>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
SoftwareInstance_checkDuplicationOnInstanceTreeConsistency
</string>
</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency.py
0 → 100644
View file @
34bf4cba
if
context
.
getSlapState
()
==
"destroy_requested"
:
return
[]
instance_tree
=
context
.
getSpecialiseValue
(
portal_type
=
"Instance Tree"
)
error_list
=
[]
if
instance_tree
:
title
=
context
.
getTitle
()
for
instance
in
instance_tree
.
getSpecialiseRelatedValueList
(
portal_type
=
[
"Slave Instance"
,
"Software Instance"
]):
if
instance
.
getSlapState
()
==
"destroy_requested"
or
\
instance
.
getUid
()
==
context
.
getUid
():
continue
if
instance
.
getTitle
()
==
title
:
error_list
.
append
(
"%s is duplicated with %s "
%
(
title
,
instance
.
getRelativeUrl
()))
return
error_list
master/bt5/slapos_
erp5/SkinTemplateItem/portal_skins/slapos_administration/Base_checkDuplicatedReference
.xml
→
master/bt5/slapos_
cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency
.xml
View file @
34bf4cba
...
@@ -50,11 +50,11 @@
...
@@ -50,11 +50,11 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
fixit
, active_process
</string>
</value>
<value>
<string>
fixit
=False
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_checkDuplicatedReference
</string>
</value>
<value>
<string>
SoftwareInstance_checkDuplicationOnInstanceTreeConsistency
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudConstraint.py
View file @
34bf4cba
...
@@ -237,9 +237,11 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
...
@@ -237,9 +237,11 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
def
test_successor_related
(
self
):
def
test_successor_related
(
self
):
software_instance2
=
self
.
portal
.
software_instance_module
.
newContent
(
software_instance2
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
)
portal_type
=
'Software Instance'
,
reference
=
"TESTSOFTINST-%s"
%
self
.
generateNewId
())
software_instance3
=
self
.
portal
.
software_instance_module
.
newContent
(
software_instance3
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
)
portal_type
=
'Software Instance'
,
reference
=
"TESTSOFTINST-%s"
%
self
.
generateNewId
())
# fetch basic list of consistency messages
# fetch basic list of consistency messages
current_message_list
=
self
.
getMessageList
(
self
.
software_instance
)
current_message_list
=
self
.
getMessageList
(
self
.
software_instance
)
...
@@ -376,9 +378,11 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
...
@@ -376,9 +378,11 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
def
test_successor_related
(
self
):
def
test_successor_related
(
self
):
software_instance2
=
self
.
portal
.
software_instance_module
.
newContent
(
software_instance2
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
)
portal_type
=
'Slave Instance'
,
reference
=
"TESTSOFTINST-%s"
%
self
.
generateNewId
())
software_instance3
=
self
.
portal
.
software_instance_module
.
newContent
(
software_instance3
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
)
portal_type
=
'Slave Instance'
,
reference
=
"TESTSOFTINST-%s"
%
self
.
generateNewId
())
# fetch basic list of consistency messages
# fetch basic list of consistency messages
current_message_list
=
self
.
getMessageList
(
self
.
software_instance
)
current_message_list
=
self
.
getMessageList
(
self
.
software_instance
)
...
@@ -546,37 +550,69 @@ class TestSlapOSComputeNodeConstraint(TestSlapOSConstraintMixin):
...
@@ -546,37 +550,69 @@ class TestSlapOSComputeNodeConstraint(TestSlapOSConstraintMixin):
consistency_message
=
'Title must be defined'
consistency_message
=
'Title must be defined'
self
.
assertTrue
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
self
.
assertTrue
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
compute_node
.
setTitle
(
self
.
generateNewId
())
compute_node
.
setTitle
(
self
.
generateNewId
())
self
.
assertFalse
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
self
.
assertFalse
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
def
test_reference_not_empty
(
self
):
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
)
consistency_message
=
'Reference must be defined'
self
.
assertTrue
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
class
TestSlapOSReferenceConstraint
(
TestSlapOSConstraintMixin
):
compute_node
.
setReference
(
self
.
generateNewId
())
def
test_reference_not_empty_compute_node
(
self
):
self
.
_test_reference_not_empty
(
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
))
self
.
assertFalse
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
def
test_reference_not_empty_software_instance
(
self
):
self
.
_test_reference_not_empty
(
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
))
def
test_reference_unique
(
self
):
def
test_reference_not_empty_slave_instance
(
self
):
reference
=
self
.
generateNewId
()
self
.
_test_reference_not_empty
(
reference_2
=
self
.
generateNewId
()
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
))
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
,
reference
=
reference
)
def
test_reference_not_empty_software_installation
(
self
):
compute_node_2
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
,
self
.
_test_reference_not_empty
(
reference
=
reference
)
self
.
portal
.
software_installation_module
.
newContent
(
portal_type
=
'Software Installation'
))
consistency_message
=
'Reference must be unique'
def
_test_reference_not_empty
(
self
,
document
):
consistency_message
=
'Reference must be defined'
self
.
assertIn
(
consistency_message
,
self
.
getMessageList
(
document
))
document
.
setReference
(
self
.
generateNewId
())
self
.
assertNotIn
(
consistency_message
,
self
.
getMessageList
(
document
))
def
test_reference_unique_compute_node
(
self
):
module
=
self
.
portal
.
compute_node_module
self
.
_test_reference_unique
(
module
.
newContent
(
portal_type
=
'Compute Node'
,
reference
=
self
.
generateNewId
()),
module
.
newContent
(
portal_type
=
'Compute Node'
,
reference
=
self
.
generateNewId
()))
def
test_reference_unique_software_instance
(
self
):
module
=
self
.
portal
.
software_instance_module
self
.
_test_reference_unique
(
module
.
newContent
(
portal_type
=
'Software Instance'
,
reference
=
self
.
generateNewId
()),
module
.
newContent
(
portal_type
=
'Software Instance'
,
reference
=
self
.
generateNewId
()))
def
test_reference_unique_slave_instance
(
self
):
module
=
self
.
portal
.
software_instance_module
self
.
_test_reference_unique
(
module
.
newContent
(
portal_type
=
'Slave Instance'
,
reference
=
self
.
generateNewId
()),
module
.
newContent
(
portal_type
=
'Slave Instance'
,
reference
=
self
.
generateNewId
()))
def
test_reference_unique_software_installation
(
self
):
module
=
self
.
portal
.
software_installation_module
self
.
_test_reference_unique
(
module
.
newContent
(
portal_type
=
'Software Installation'
,
reference
=
self
.
generateNewId
()),
module
.
newContent
(
portal_type
=
'Software Installation'
,
reference
=
self
.
generateNewId
()))
def
_test_reference_unique
(
self
,
documentA
,
documentB
):
consistency_message
=
'Reference must be unique'
self
.
tic
()
self
.
tic
()
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
documentA
))
self
.
assert
True
(
consistency_message
in
self
.
getMessageList
(
compute_node_2
))
self
.
assert
NotIn
(
consistency_message
,
self
.
getMessageList
(
documentB
))
compute_node_2
.
setReference
(
reference_2
)
documentB
.
setReference
(
documentA
.
getReference
()
)
self
.
tic
()
self
.
tic
()
self
.
assertFalse
(
consistency_message
in
self
.
getMessageList
(
compute_node
))
self
.
assertEqual
(
documentB
.
getReference
(),
documentA
.
getReference
())
self
.
assertFalse
(
consistency_message
in
self
.
getMessageList
(
compute_node_2
))
self
.
assertIn
(
consistency_message
,
self
.
getMessageList
(
documentA
))
self
.
assertIn
(
consistency_message
,
self
.
getMessageList
(
documentB
))
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudConstraint.xml
View file @
34bf4cba
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</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>
testSlapOSCloudConstraint
</string>
</value>
<value>
<string>
testSlapOSCloudConstraint
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</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>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_cloud/bt/template_portal_type_property_sheet_list
View file @
34bf4cba
...
@@ -3,6 +3,7 @@ Assignment | SlaposAssignmentConstraint
...
@@ -3,6 +3,7 @@ Assignment | SlaposAssignmentConstraint
Compute Node | ComputeNodeSlapOSMetadata
Compute Node | ComputeNodeSlapOSMetadata
Compute Node | ComputerUpgradeConstraint
Compute Node | ComputerUpgradeConstraint
Compute Node | ERP5User
Compute Node | ERP5User
Compute Node | SlapOSReferenceConstraint
Compute Node | SlaposCapacity
Compute Node | SlaposCapacity
Compute Node | SlaposComputeNodeConstraint
Compute Node | SlaposComputeNodeConstraint
Compute Node | Url
Compute Node | Url
...
@@ -25,18 +26,23 @@ Instance Tree | VariationRange
...
@@ -25,18 +26,23 @@ Instance Tree | VariationRange
Person | SlaposPersonConstraint
Person | SlaposPersonConstraint
Slave Instance | InstanceTree
Slave Instance | InstanceTree
Slave Instance | Reference
Slave Instance | Reference
Slave Instance | SlapOSReferenceConstraint
Slave Instance | SlaveInstanceConstraint
Slave Instance | SlaveInstanceConstraint
Slave Instance | SoftwareInstance
Slave Instance | SoftwareInstance
Slave Instance | SoftwareInstanceDuplicationConstraint
Slave Instance | TextDocument
Slave Instance | TextDocument
Slave Instance | Url
Slave Instance | Url
Slave Instance | VariationRange
Slave Instance | VariationRange
Software Installation | SlapOSReferenceConstraint
Software Installation | Url
Software Installation | Url
Software Installation | VariationRange
Software Installation | VariationRange
Software Instance | ERP5User
Software Instance | ERP5User
Software Instance | InstanceTree
Software Instance | InstanceTree
Software Instance | Reference
Software Instance | Reference
Software Instance | SlapOSReferenceConstraint
Software Instance | SoftwareInstance
Software Instance | SoftwareInstance
Software Instance | SoftwareInstanceConstraint
Software Instance | SoftwareInstanceConstraint
Software Instance | SoftwareInstanceDuplicationConstraint
Software Instance | SoftwareInstanceUpgradeConstraint
Software Instance | SoftwareInstanceUpgradeConstraint
Software Instance | TextDocument
Software Instance | TextDocument
Software Instance | Url
Software Instance | Url
...
...
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
View file @
34bf4cba
...
@@ -10,6 +10,7 @@ ComputerPartitionUpgradeConstraint
...
@@ -10,6 +10,7 @@ ComputerPartitionUpgradeConstraint
ComputePartition
ComputePartition
SoftwareInstance
SoftwareInstance
SoftwareInstanceUpgradeConstraint
SoftwareInstanceUpgradeConstraint
SoftwareInstanceDuplicationConstraint
InstanceTree
InstanceTree
SlaposCapacity
SlaposCapacity
SlaposPersonConstraint
SlaposPersonConstraint
...
@@ -17,3 +18,4 @@ SlaposAssignmentConstraint
...
@@ -17,3 +18,4 @@ SlaposAssignmentConstraint
SlaposEmailConstraint
SlaposEmailConstraint
SlaposComputeNodeConstraint
SlaposComputeNodeConstraint
ComputeNodeSlapOSMetadata
ComputeNodeSlapOSMetadata
SlapOSReferenceConstraint
\ No newline at end of file
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedObjectReference.py
deleted
100644 → 0
View file @
1bf8c5a0
active_process
=
context
.
newActiveProcess
().
getRelativeUrl
()
context
.
getPortalObject
().
portal_catalog
.
searchAndActivate
(
method_id
=
'Base_checkDuplicatedReference'
,
method_kw
=
dict
(
fixit
=
fixit
,
active_process
=
active_process
),
activate_kw
=
dict
(
tag
=
tag
,
priority
=
5
),
portal_type
=
[
"Instance Tree"
,
"Compute Node"
,
"Software Instance"
,
"Slave Instance"
,
"Software Installation"
],
validation_state
=
"validated"
)
return
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedObjectReference.xml
deleted
100644 → 0
View file @
1bf8c5a0
<?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>
_params
</string>
</key>
<value>
<string>
tag, fixit, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_searchDuplicatedObjectReference
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.py
deleted
100644 → 0
View file @
1bf8c5a0
active_process
=
context
.
newActiveProcess
().
getRelativeUrl
()
context
.
getPortalObject
().
portal_catalog
.
searchAndActivate
(
method_id
=
'InstanceTree_checkDuplicatedInstance'
,
method_kw
=
dict
(
fixit
=
fixit
,
active_process
=
active_process
),
activate_kw
=
dict
(
tag
=
tag
,
priority
=
5
),
portal_type
=
"Instance Tree"
,
validation_state
=
"validated"
)
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.xml
deleted
100644 → 0
View file @
1bf8c5a0
<?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>
_params
</string>
</key>
<value>
<string>
tag, fixit, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_searchDuplicatedSoftwareInstance
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Base_checkDuplicatedReference.py
deleted
100644 → 0
View file @
1bf8c5a0
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
reference
=
context
.
getReference
()
active_process
=
portal
.
restrictedTraverse
(
active_process
)
result
=
portal
.
portal_catalog
(
portal_type
=
context
.
getPortalType
(),
reference
=
reference
,
limit
=
2
)
if
len
(
result
)
!=
1
:
active_process
.
postResult
(
ActiveResult
(
summary
=
"%s %s has duplication"
%
(
context
.
getRelativeUrl
(),
context
.
getReference
()),
severity
=
100
,
detail
=
""
))
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/InstanceTree_checkDuplicatedInstance.py
deleted
100644 → 0
View file @
1bf8c5a0
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
software_instance_list
=
context
.
getSpecialiseRelatedValueList
(
portal_type
=
[
"Slave Instance"
,
"Software Instance"
])
if
len
(
software_instance_list
)
==
1
:
return
title_dict
=
{}
active_process
=
portal
.
restrictedTraverse
(
active_process
)
for
software_instance
in
software_instance_list
:
if
software_instance
.
getSlapState
()
==
"destroy_requested"
:
continue
title
=
software_instance
.
getTitle
()
if
title
in
title_dict
:
title_dict
[
title
].
append
(
software_instance
.
getObject
())
else
:
title_dict
[
title
]
=
[
software_instance
.
getObject
()]
for
title
in
title_dict
:
if
len
(
title_dict
[
title
])
>
1
:
if
fixit
:
for
software_instance
in
title_dict
[
title
]:
if
len
(
software_instance
.
getAggregate
([]))
==
0
:
active_process
.
postResult
(
ActiveResult
(
summary
=
"Fixing %s which duplication and is not allocated (%s)"
\
%
(
software_instance
.
getRelativeUrl
(),
context
.
getRelativeUrl
()),
severity
=
0
,
detail
=
""
))
software_instance
.
activate
().
SoftwareInstance_destroyAsSelf
()
else
:
active_process
.
postResult
(
ActiveResult
(
summary
=
"%s has duplication"
%
context
.
getRelativeUrl
(),
severity
=
100
,
detail
=
"%s has duplication on %s (%s)"
%
(
context
.
getRelativeUrl
(),
title
,
len
(
title_dict
[
title
]))))
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/InstanceTree_checkDuplicatedInstance.xml
deleted
100644 → 0
View file @
1bf8c5a0
<?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>
_params
</string>
</key>
<value>
<string>
fixit, active_process
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
InstanceTree_checkDuplicatedInstance
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/bt/template_path_list
View file @
34bf4cba
notification_message_module/slapos_erp5_credential_recovery_password_expiration_link_en_001
notification_message_module/slapos_erp5_credential_recovery_password_expiration_link_en_001
notification_message_module/slapos_erp5_credential_recovery_password_expiration_link_en_001/**
notification_message_module/slapos_erp5_credential_recovery_password_expiration_link_en_001/**
portal_alarms/open_bugs_alarm
portal_alarms/open_bugs_alarm
portal_alarms/slapos_check_duplicated_software_instance
portal_alarms/slapos_check_security_uid
portal_alarms/slapos_check_security_uid
portal_alarms/slapos_check_stored_broken_state
portal_alarms/slapos_check_stored_broken_state
portal_alarms/slapos_erp5_cleanup_active_process
portal_alarms/slapos_erp5_cleanup_active_process
...
...
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