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
Carlos Ramos Carreño
slapos.core
Commits
5d367b70
Commit
5d367b70
authored
Apr 26, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Fixup Dupplication on Supply
See merge request
nexedi/slapos.core!623
parents
e71421ce
f767696d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
15 deletions
+42
-15
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+1
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+10
-4
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
...t.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
+5
-2
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/compute_node_slap_interface_workflow/script_ComputeNode_requestSoftwareReleaseChange.py
...rkflow/script_ComputeNode_requestSoftwareReleaseChange.py
+25
-8
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/AllocationSupply_validateAndSupplyComputeNodeList.py
...anel/AllocationSupply_validateAndSupplyComputeNodeList.py
+1
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
5d367b70
...
@@ -179,6 +179,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -179,6 +179,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
def
supplySoftware
(
self
,
server
,
url
,
state
=
'available'
):
def
supplySoftware
(
self
,
server
,
url
,
state
=
'available'
):
self
.
portal
.
portal_slap
.
supplySupply
(
url
,
server
.
getReference
(),
state
)
self
.
portal
.
portal_slap
.
supplySupply
(
url
,
server
.
getReference
(),
state
)
self
.
tic
()
self
.
tic
()
self
.
cleanUpRequest
()
software_installation
=
self
.
portal
.
portal_catalog
.
getResultValue
(
software_installation
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Installation'
,
portal_type
=
'Software Installation'
,
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
5d367b70
...
@@ -142,10 +142,9 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -142,10 +142,9 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
_custom_additional_bt5_list
=
[]
_custom_additional_bt5_list
=
[]
# Used by testSlapOSERP5GroupRoleSecurity.TestSlapOSGroupRoleSecurityCoverage for
# Used by testSlapOSERP5GroupRoleSecurity.TestSlapOSGroupRoleSecurityCoverage for
# searh classes for assert overage
# sear
c
h classes for assert overage
security_group_role_test_id_list
=
[
'test.erp5.testSlapOSERP5GroupRoleSecurity'
]
security_group_role_test_id_list
=
[
'test.erp5.testSlapOSERP5GroupRoleSecurity'
]
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
testSlapOSMixin
.
afterSetUp
(
self
)
testSlapOSMixin
.
afterSetUp
(
self
)
self
.
changeSkin
(
'View'
)
self
.
changeSkin
(
'View'
)
...
@@ -156,6 +155,14 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -156,6 +155,14 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
"""Overwrite this function on project context to tweak production focus tests"""
"""Overwrite this function on project context to tweak production focus tests"""
pass
pass
def
cleanUpRequest
(
self
):
""" set None some values that can cause problems in tests
"""
for
key
in
self
.
portal
.
REQUEST
.
keys
():
if
key
.
endswith
(
"_inProgress"
):
# Reset values set on script_ComputeNode_requestSoftwareReleaseChange
self
.
portal
.
REQUEST
.
set
(
key
,
None
)
def
addAccountingManagerAssignment
(
self
,
person
):
def
addAccountingManagerAssignment
(
self
,
person
):
person
.
newContent
(
person
.
newContent
(
portal_type
=
'Assignment'
,
portal_type
=
'Assignment'
,
...
@@ -290,7 +297,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -290,7 +297,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
project_reference
=
project
.
getReference
()
project_reference
=
project
.
getReference
()
)
)
# As the software url does not match any service, and any trade condition
# As the software url does not match any service, and any trade condition
# no instance is automatically created.
# no instance is automatically created.
# except if we fake Item_getSubscriptionStatus
# except if we fake Item_getSubscriptionStatus
with
TemporaryAlarmScript
(
self
.
portal
,
'Item_getSubscriptionStatus'
,
"'subscribed'"
):
with
TemporaryAlarmScript
(
self
.
portal
,
'Item_getSubscriptionStatus'
,
"'subscribed'"
):
...
@@ -352,7 +359,6 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -352,7 +359,6 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
self
.
software_instance
.
validate
()
self
.
software_instance
.
validate
()
self
.
requested_software_instance
.
edit
(
self
.
requested_software_instance
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
View file @
5d367b70
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
##############################################################################
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
import
transaction
import
transaction
from
unittest
import
expectedFailure
from
Products.ERP5Type.Errors
import
UnsupportedWorkflowMethod
from
Products.ERP5Type.Errors
import
UnsupportedWorkflowMethod
...
@@ -212,6 +211,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
...
@@ -212,6 +211,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
compute_node
.
requestSoftwareRelease
(
software_release_url
=
url
,
self
.
compute_node
.
requestSoftwareRelease
(
software_release_url
=
url
,
state
=
'available'
)
state
=
'available'
)
self
.
tic
()
self
.
tic
()
self
.
cleanUpRequest
()
self
.
login
()
self
.
login
()
software_installation
=
self
.
compute_node
.
getAggregateRelatedValue
(
software_installation
=
self
.
compute_node
.
getAggregateRelatedValue
(
portal_type
=
'Software Installation'
)
portal_type
=
'Software Installation'
)
...
@@ -245,7 +245,6 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
...
@@ -245,7 +245,6 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
state
=
'available'
)
state
=
'available'
)
transaction
.
abort
()
transaction
.
abort
()
@
expectedFailure
def
test_requestSoftwareRelease_same_transaction
(
self
):
def
test_requestSoftwareRelease_same_transaction
(
self
):
self
.
person_user
=
self
.
makePerson
(
self
.
project
)
self
.
person_user
=
self
.
makePerson
(
self
.
project
)
self
.
addProjectProductionManagerAssignment
(
self
.
person_user
,
self
.
project
)
self
.
addProjectProductionManagerAssignment
(
self
.
person_user
,
self
.
project
)
...
@@ -641,6 +640,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
...
@@ -641,6 +640,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
software_installation
.
getReference
())
software_installation
.
getReference
())
self
.
tic
()
self
.
tic
()
self
.
cleanUpRequest
()
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"available"
,
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"available"
,
software_release_url
=
software_release
)
software_release_url
=
software_release
)
...
@@ -673,6 +673,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
...
@@ -673,6 +673,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
software_installation
.
getReference
())
software_installation
.
getReference
())
self
.
tic
()
self
.
tic
()
self
.
cleanUpRequest
()
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"destroyed"
,
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_release_url
=
software_release
)
...
@@ -714,6 +715,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
...
@@ -714,6 +715,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
software_installation
.
getReference
())
software_installation
.
getReference
())
self
.
tic
()
self
.
tic
()
self
.
cleanUpRequest
()
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"destroyed"
,
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_release_url
=
software_release
)
...
@@ -761,6 +763,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
...
@@ -761,6 +763,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
software_installation
.
getReference
())
software_installation
.
getReference
())
self
.
tic
()
self
.
tic
()
self
.
cleanUpRequest
()
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"destroyed"
,
self
.
compute_node
.
requestSoftwareRelease
(
state
=
"destroyed"
,
software_release_url
=
software_release
)
software_release_url
=
software_release
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/compute_node_slap_interface_workflow/script_ComputeNode_requestSoftwareReleaseChange.py
View file @
5d367b70
...
@@ -14,7 +14,7 @@ except KeyError:
...
@@ -14,7 +14,7 @@ except KeyError:
tag
=
"%s_%s_inProgress"
%
(
compute_node
.
getUid
(),
tag
=
"%s_%s_inProgress"
%
(
compute_node
.
getUid
(),
software_release_url
)
software_release_url
)
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
or
compute_node
.
REQUEST
.
get
(
tag
)
==
tag
):
# The software instance is already under creation but can not be fetched from catalog
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
raise
NotImplementedError
(
tag
)
...
@@ -26,22 +26,38 @@ software_installation_list = portal.portal_catalog(
...
@@ -26,22 +26,38 @@ software_installation_list = portal.portal_catalog(
url_string
=
{
'query'
:
software_release_url
,
'key'
:
'ExactMatch'
},
url_string
=
{
'query'
:
software_release_url
,
'key'
:
'ExactMatch'
},
validation_state
=
"validated"
,
validation_state
=
"validated"
,
default_aggregate_uid
=
compute_node
.
getUid
(),
default_aggregate_uid
=
compute_node
.
getUid
(),
limit
=
2
,
# takes only a portion, usually it will be 1 or 0
limit
=
10
,
)
)
if
len
(
software_installation_list
)
>
1
:
def
test_software_installation
(
software_installation
):
raise
NotImplementedError
(
"Too many Software Installation %s found %s"
%
(
software_release_url
,
[
x
.
path
for
x
in
software_installation_list
]))
elif
len
(
software_installation_list
)
==
1
:
software_installation
=
software_installation_list
[
0
].
getObject
()
if
(
software_installation
.
getUrlString
()
!=
software_release_url
)
or
\
if
(
software_installation
.
getUrlString
()
!=
software_release_url
)
or
\
(
software_installation
.
getValidationState
()
!=
"validated"
)
or
\
(
software_installation
.
getValidationState
()
!=
"validated"
)
or
\
(
software_installation
.
getAggregate
()
!=
compute_node
.
getRelativeUrl
()):
(
software_installation
.
getAggregate
()
!=
compute_node
.
getRelativeUrl
()):
raise
NotImplementedError
(
"The system was not able to get the expected Software Installation"
)
raise
NotImplementedError
(
"The system was not able to get the expected Software Installation"
)
return
software_installation
if
len
(
software_installation_list
)
>
1
:
software_installation
=
test_software_installation
(
software_installation_list
[
0
].
getObject
())
for
software_installation_found
in
list
(
software_installation_list
)[
1
:]:
test_software_installation
(
software_installation_found
.
getObject
())
if
software_installation_found
.
getSlapState
()
==
software_installation
.
getSlapState
():
software_installation_found
.
requestDestroy
(
activate_kw
=
{
'tag'
:
tag
})
software_installation_found
.
invalidate
()
else
:
raise
NotImplementedError
(
"Too many Software Installation %s found %s (clean up not possible)"
%
(
software_release_url
,
[
x
.
path
for
x
in
software_installation_list
]))
elif
len
(
software_installation_list
)
==
1
:
software_installation
=
test_software_installation
(
software_installation_list
[
0
].
getObject
())
else
:
else
:
if
(
state
==
"destroyed"
):
if
(
state
==
"destroyed"
):
# No need to create destroyed subscription.
# No need to create destroyed subscription.
return
return
software_installation_reference
=
"SOFTINSTALL-%s"
%
context
.
getPortalObject
()
.
portal_ids
\
software_installation_reference
=
"SOFTINSTALL-%s"
%
portal
.
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_installation
=
portal
.
getDefaultModule
(
portal_type
=
software_installation_portal_type
).
newContent
(
software_installation
=
portal
.
getDefaultModule
(
portal_type
=
software_installation_portal_type
).
newContent
(
portal_type
=
software_installation_portal_type
,
portal_type
=
software_installation_portal_type
,
...
@@ -51,6 +67,7 @@ else:
...
@@ -51,6 +67,7 @@ else:
follow_up_value
=
compute_node
.
getFollowUpValue
(),
follow_up_value
=
compute_node
.
getFollowUpValue
(),
activate_kw
=
{
'tag'
:
tag
}
activate_kw
=
{
'tag'
:
tag
}
)
)
compute_node
.
REQUEST
.
set
(
tag
,
tag
)
# Change desired state
# Change desired state
if
(
state
==
"available"
):
if
(
state
==
"available"
):
...
@@ -67,4 +84,4 @@ if validation_state == 'draft':
...
@@ -67,4 +84,4 @@ if validation_state == 'draft':
portal
.
portal_workflow
.
doActionFor
(
software_installation
,
portal
.
portal_workflow
.
doActionFor
(
software_installation
,
'validate_action'
)
'validate_action'
)
co
ntext
.
REQUEST
.
set
(
'software_installation_url'
,
software_installation
.
getRelativeUrl
())
co
mpute_node
.
REQUEST
.
set
(
'software_installation_url'
,
software_installation
.
getRelativeUrl
())
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/AllocationSupply_validateAndSupplyComputeNodeList.py
View file @
5d367b70
...
@@ -8,7 +8,7 @@ for allocation_supply_line in allocation_supply.contentValues(portal_type="Alloc
...
@@ -8,7 +8,7 @@ for allocation_supply_line in allocation_supply.contentValues(portal_type="Alloc
for
allocation_supply_cell
in
allocation_supply_line
.
contentValues
(
portal_type
=
"Allocation Supply Cell"
):
for
allocation_supply_cell
in
allocation_supply_line
.
contentValues
(
portal_type
=
"Allocation Supply Cell"
):
if
allocation_supply_cell
.
isAllocable
():
if
allocation_supply_cell
.
isAllocable
():
release_variation
=
allocation_supply_cell
.
getSoftwareReleaseValue
()
release_variation
=
allocation_supply_cell
.
getSoftwareReleaseValue
()
if
release_variation
is
not
None
:
if
release_variation
is
not
None
and
release_variation
.
getUrlString
()
not
in
url_string_list
:
url_string_list
.
append
(
release_variation
.
getUrlString
())
url_string_list
.
append
(
release_variation
.
getUrlString
())
for
compute_node
in
allocation_supply
.
getAggregateValueList
(
portal_type
=
"Compute Node"
):
for
compute_node
in
allocation_supply
.
getAggregateValueList
(
portal_type
=
"Compute Node"
):
...
...
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