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
60948897
Commit
60948897
authored
Jan 12, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Drop useless duplication
parent
28838e29
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
49 additions
and
121 deletions
+49
-121
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getAggregateValue.py
...tal_skins/slapos_pdm/UpgradeDecision_getAggregateValue.py
+12
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getAggregateValue.xml
...al_skins/slapos_pdm/UpgradeDecision_getAggregateValue.xml
+2
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputeNode.py
...portal_skins/slapos_pdm/UpgradeDecision_getComputeNode.py
+0
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getInstanceTree.py
...ortal_skins/slapos_pdm/UpgradeDecision_getInstanceTree.py
+0
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getInstanceTree.xml
...rtal_skins/slapos_pdm/UpgradeDecision_getInstanceTree.xml
+0
-62
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
...tal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
+2
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
...ateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
+3
-3
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
...ortal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
+3
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.py
...em/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.py
+1
-1
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputeNode.py
...al_skins/slapos_pdm/UpgradeDecision_upgradeComputeNode.py
+1
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeInstanceTree.py
...l_skins/slapos_pdm/UpgradeDecision_upgradeInstanceTree.py
+2
-1
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
...ents/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
+1
-1
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
+22
-19
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getAggregateValue.py
0 → 100644
View file @
60948897
document_list
=
[]
for
decision_line
in
context
.
contentValues
():
document_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
document_portal_type
))
if
len
(
document_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 %s"
%
document_list
)
if
len
(
document_list
)
==
0
:
return
None
return
document_list
[
0
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_get
ComputeNod
e.xml
→
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_get
AggregateValu
e.xml
View file @
60948897
...
...
@@ -50,11 +50,11 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
document_portal_type="Instance Tree"
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_get
ComputeNod
e
</string>
</value>
<value>
<string>
UpgradeDecision_get
AggregateValu
e
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputeNode.py
deleted
100644 → 0
View file @
28838e29
compute_node_list
=
[]
for
decision_line
in
context
.
contentValues
():
compute_node_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
"Compute Node"
))
if
len
(
compute_node_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 Compute Node"
)
if
len
(
compute_node_list
)
==
0
:
return
None
return
compute_node_list
[
0
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getInstanceTree.py
deleted
100644 → 0
View file @
28838e29
instance_tree_list
=
[]
for
decision_line
in
context
.
contentValues
():
instance_tree_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
"Instance Tree"
))
if
len
(
instance_tree_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 Instance Tree"
)
if
len
(
instance_tree_list
)
==
0
:
return
None
return
instance_tree_list
[
0
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getInstanceTree.xml
deleted
100644 → 0
View file @
28838e29
<?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></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_getInstanceTree
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
View file @
60948897
portal
=
context
.
getPortalObject
()
instance_tree
=
context
.
UpgradeDecision_get
InstanceTree
(
)
compute_node
=
context
.
UpgradeDecision_get
ComputeNode
(
)
instance_tree
=
context
.
UpgradeDecision_get
AggregateValue
(
"Instance Tree"
)
compute_node
=
context
.
UpgradeDecision_get
AggregateValue
(
"Compute Node"
)
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
if
instance_tree
is
not
None
:
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
View file @
60948897
...
...
@@ -10,9 +10,9 @@ person = context.getDestinationDecisionValue(portal_type="Person")
if
not
person
:
raise
ValueError
(
"Inconsistent Upgrade Decision, No Destination Decision"
)
instance_tree
=
context
.
UpgradeDecision_get
InstanceTree
(
)
compute_node
=
context
.
UpgradeDecision_get
ComputeNode
(
)
software_release
=
context
.
UpgradeDecision_get
SoftwareRelease
(
)
instance_tree
=
context
.
UpgradeDecision_get
AggregateValue
(
"Instance Tree"
)
compute_node
=
context
.
UpgradeDecision_get
AggregateValue
(
"Compute Node"
)
software_release
=
context
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
software_product_title
=
software_release
.
getAggregateTitle
(
portal_type
=
"Software Product"
)
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
View file @
60948897
...
...
@@ -12,8 +12,9 @@ person = context.getDestinationDecisionValue(portal_type="Person")
if
not
person
:
raise
ValueError
(
"Inconsistent Upgrade Decision, No Destination Decision"
)
instance_tree
=
context
.
UpgradeDecision_getInstanceTree
()
compute_node
=
context
.
UpgradeDecision_getComputeNode
()
instance_tree
=
context
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
compute_node
=
context
.
UpgradeDecision_getAggregateValue
(
"Compute Node"
)
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
software_product_title
=
software_release
.
getAggregateTitle
(
portal_type
=
"Software Product"
)
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.py
View file @
60948897
...
...
@@ -8,7 +8,7 @@ if simulation_state in require_state_list:
if
not
current_release
:
# This upgrade decision is not valid
return
False
instance_tree
=
upgrade_decision
.
UpgradeDecision_getInstanceTree
(
)
instance_tree
=
context
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
if
instance_tree
is
not
None
:
current_instance_tree_release
=
instance_tree
.
getUrlString
()
if
current_instance_tree_release
==
new_url_string
:
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputeNode.py
View file @
60948897
...
...
@@ -2,7 +2,7 @@ if context.getSimulationState() != 'started':
# Update Decision is not on started state, Upgrade is not possible!
return
False
compute_node
=
context
.
UpgradeDecision_get
ComputeNode
(
)
compute_node
=
context
.
UpgradeDecision_get
AggregateValue
(
"Compute Node"
)
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
if
compute_node
is
None
:
...
...
@@ -12,7 +12,6 @@ if software_release is None:
return
False
software_release_url
=
software_release
.
getUrlString
()
compute_node
.
requestSoftwareRelease
(
software_release_url
=
software_release_url
,
state
=
"available"
)
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeInstanceTree.py
View file @
60948897
...
...
@@ -2,7 +2,8 @@ if context.getSimulationState() != 'started':
# Update Decision is not on started state, Upgrade is not possible!
return
False
instance_tree
=
context
.
UpgradeDecision_getInstanceTree
()
instance_tree
=
context
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
if
instance_tree
is
None
:
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
View file @
60948897
...
...
@@ -284,7 +284,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self
.
assertNotEqual
(
up_decision
,
None
)
self
.
assertEqual
(
up_decision
.
getSimulationState
(),
'planned'
)
self
.
assertEqual
(
up_decision
.
UpgradeDecision_get
InstanceTree
(
).
\
self
.
assertEqual
(
up_decision
.
UpgradeDecision_get
AggregateValue
(
"Instance Tree"
).
\
getReference
(),
instance_tree
.
getReference
())
self
.
assertEqual
(
up_decision
.
UpgradeDecision_getSoftwareRelease
().
\
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
View file @
60948897
...
...
@@ -338,7 +338,7 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValue
(
compute_node
)
found_compute_node
=
upgrade_decision
.
UpgradeDecision_get
ComputeNode
(
)
found_compute_node
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Compute Node"
)
self
.
assertEqual
(
compute_node
.
getRelativeUrl
(),
found_compute_node
.
getRelativeUrl
())
...
...
@@ -351,7 +351,7 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
found_compute_node
=
upgrade_decision
.
UpgradeDecision_get
ComputeNode
(
)
found_compute_node
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Compute Node"
)
self
.
assertEqual
(
compute_node
.
getRelativeUrl
(),
found_compute_node
.
getRelativeUrl
())
...
...
@@ -365,13 +365,14 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValue
(
compute_node
)
self
.
assertRaises
(
ValueError
,
upgrade_decision
.
UpgradeDecision_getComputeNode
)
self
.
assertRaises
(
ValueError
,
upgrade_decision
.
UpgradeDecision_getAggregateValue
,
document_portal_type
=
"Compute Node"
)
def
testUpgradeDecision_getComputeNode_O_compute_node
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
found_compute_node
=
upgrade_decision
.
UpgradeDecision_get
ComputeNode
(
)
found_compute_node
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Compute Node"
)
self
.
assertEqual
(
None
,
found_compute_node
)
...
...
@@ -382,7 +383,7 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValue
(
instance_tree
)
found_instance_tree
=
upgrade_decision
.
UpgradeDecision_get
InstanceTree
(
)
found_instance_tree
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Instance Tree"
)
self
.
assertEqual
(
instance_tree
.
getRelativeUrl
(),
found_instance_tree
.
getRelativeUrl
())
...
...
@@ -396,7 +397,7 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
found_instance_tree
=
upgrade_decision
.
UpgradeDecision_get
InstanceTree
(
)
found_instance_tree
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Instance Tree"
)
self
.
assertEqual
(
instance_tree
.
getRelativeUrl
(),
found_instance_tree
.
getRelativeUrl
())
...
...
@@ -411,28 +412,29 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValue
(
instance_tree
)
self
.
assertRaises
(
ValueError
,
upgrade_decision
.
UpgradeDecision_getInstanceTree
)
self
.
assertRaises
(
ValueError
,
upgrade_decision
.
UpgradeDecision_getAggregateValue
,
document_portal_type
=
"Instance Tree"
)
def
testUpgradeDecision_getInstanceTree_O_hosting
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
found_instance_tree
=
upgrade_decision
.
UpgradeDecision_get
InstanceTree
(
)
found_instance_tree
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Instance Tree"
)
self
.
assertEqual
(
None
,
found_instance_tree
)
def
testUpgradeDecision_getSoftwareRelease
(
self
):
def
testUpgradeDecision_get
AggregateValue_
SoftwareRelease
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValue
(
software_release
)
found_software_release
=
upgrade_decision
.
UpgradeDecision_get
SoftwareRelease
(
)
found_software_release
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
self
.
assertEqual
(
software_release
.
getRelativeUrl
(),
found_software_release
.
getRelativeUrl
())
def
testUpgradeDecision_getSoftwareRelease_2_lines
(
self
):
def
testUpgradeDecision_get
AggregateValue_
SoftwareRelease_2_lines
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
@@ -441,11 +443,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
found_software_release
=
upgrade_decision
.
UpgradeDecision_get
SoftwareRelease
(
)
found_software_release
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
self
.
assertEqual
(
software_release
.
getRelativeUrl
(),
found_software_release
.
getRelativeUrl
())
def
testUpgradeDecision_getSoftwareRelease_2_sr
(
self
):
def
testUpgradeDecision_get
AggregateValue_
SoftwareRelease_2_sr
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
...
...
@@ -455,13 +457,14 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValue
(
software_release
)
self
.
assertRaises
(
ValueError
,
upgrade_decision
.
UpgradeDecision_getSoftwareRelease
)
self
.
assertRaises
(
ValueError
,
upgrade_decision
.
UpgradeDecision_getAggregateValue
,
document_portal_type
=
"Software Release"
)
def
testUpgradeDecision_getSoftwareRelease_O_sr
(
self
):
def
testUpgradeDecision_get
AggregateValue_
SoftwareRelease_O_sr
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
found_software_release
=
upgrade_decision
.
UpgradeDecision_get
SoftwareRelease
(
)
found_software_release
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
self
.
assertEqual
(
None
,
found_software_release
)
@
simulate
(
'InstanceTree_isUpgradePossible'
,
...
...
@@ -966,10 +969,10 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
len
(
upgrade_decision
),
1
)
self
.
assertEqual
(
upgrade_decision
[
0
].
getSimulationState
(),
'started'
)
compute_node_aggregate
=
upgrade_decision
[
0
].
UpgradeDecision_get
ComputeNode
()
compute_node_aggregate
=
upgrade_decision
[
0
].
UpgradeDecision_get
AggregateValue
(
"Compute Node"
)
()
self
.
assertEqual
(
compute_node_aggregate
.
getReference
(),
compute_node
.
getReference
())
release
=
upgrade_decision
[
0
].
UpgradeDecision_get
SoftwareRelease
(
)
release
=
upgrade_decision
[
0
].
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
self
.
assertEqual
(
release
.
getUrlString
(),
software_release2
.
getUrlString
())
self
.
tic
()
...
...
@@ -1001,7 +1004,7 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
upgrade_decision
.
getSimulationState
(),
'cancelled'
)
self
.
assertEqual
(
upgrade_decision2
.
getSimulationState
(),
'planned'
)
release
=
upgrade_decision2
.
UpgradeDecision_get
SoftwareRelease
(
)
release
=
upgrade_decision2
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
self
.
assertEqual
(
release
.
getUrlString
(),
software_release3
.
getUrlString
())
...
...
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