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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
7224f978
Commit
7224f978
authored
May 24, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: require a project reference when requesting a compute node
parent
fa5102a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.py
...ap_interface_workflow/script_Person_requestComputeNode.py
+14
-1
No files found.
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.py
View file @
7224f978
...
...
@@ -8,7 +8,12 @@ kwargs = state_change.kwargs
try
:
compute_node_title
=
kwargs
[
'compute_node_title'
]
except
KeyError
:
raise
TypeError
,
"Person_requestComputeNode takes exactly 1 argument"
raise
TypeError
,
"Person_requestComputeNode takes exactly 2 arguments. Missing compute_node_title."
try
:
project_reference
=
kwargs
[
'project_reference'
]
except
KeyError
:
raise
TypeError
,
"Person_requestComputeNode takes exactly 2 arguments. Missing project_reference."
tag
=
"%s_%s_ComputeNodeInProgress"
%
(
person
.
getUid
(),
compute_node_title
)
...
...
@@ -17,6 +22,12 @@ if (portal.portal_activities.countMessageWithTag(tag) > 0):
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
# Ensure project is correctly set
project_list
=
portal
.
portal_catalog
.
portal_catalog
(
portal_type
=
'Project'
,
reference
=
project_reference
,
validation_state
=
'validated'
,
limit
=
2
)
if
len
(
project_list
)
!=
1
:
raise
NotImplementedError
compute_node_portal_type
=
"Compute Node"
compute_node_list
=
portal
.
portal_catalog
.
portal_catalog
(
portal_type
=
compute_node_portal_type
,
title
=
compute_node_title
,
limit
=
2
)
...
...
@@ -24,6 +35,7 @@ if len(compute_node_list) == 2:
raise
NotImplementedError
elif
len
(
compute_node_list
)
==
1
:
compute_node
=
compute_node_list
[
0
]
assert
compute_node
.
getFollowUp
()
==
project_list
[
0
].
getRelativeUrl
()
else
:
reference
=
"COMP-%s"
%
portal
.
portal_ids
.
generateNewId
(
...
...
@@ -34,6 +46,7 @@ else:
portal_type
=
compute_node_portal_type
,
title
=
compute_node_title
,
reference
=
reference
,
follow_up_value
=
project_list
[
0
],
activate_kw
=
{
'tag'
:
tag
}
)
compute_node
.
approveComputeNodeRegistration
()
...
...
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