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
4a978cf6
Commit
4a978cf6
authored
Jun 01, 2022
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: requesting an instance tree requires a project
parent
da98e648
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
...terface_workflow/script_Person_requestSoftwareInstance.py
+10
-1
No files found.
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
View file @
4a978cf6
...
...
@@ -13,8 +13,9 @@ try:
sla_xml
=
kwargs
[
"sla_xml"
]
is_slave
=
kwargs
[
"shared"
]
root_state
=
kwargs
[
"state"
]
project_reference
=
kwargs
[
'project_reference'
]
except
KeyError
:
raise
TypeError
,
"Person_requestSoftwareInstance takes exactly
7
arguments"
raise
TypeError
,
"Person_requestSoftwareInstance takes exactly
8
arguments"
if
is_slave
not
in
[
True
,
False
]:
raise
ValueError
,
"shared should be a boolean"
...
...
@@ -29,6 +30,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
(
"%i projects '%s'"
%
(
len
(
project_list
),
project_reference
))
# Check if it already exists
request_instance_tree_list
=
portal
.
portal_catalog
(
portal_type
=
instance_tree_portal_type
,
...
...
@@ -41,6 +48,7 @@ if len(request_instance_tree_list) > 1:
raise
NotImplementedError
,
"Too many instance tree %s found %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_instance_tree_list
])
elif
len
(
request_instance_tree_list
)
==
1
:
request_instance_tree
=
request_instance_tree_list
[
0
].
getObject
()
assert
request_instance_tree
.
getFollowUp
()
==
project_list
[
0
].
getRelativeUrl
()
if
(
request_instance_tree
.
getSlapState
()
==
"destroy_requested"
)
or
\
(
request_instance_tree
.
getTitle
()
!=
software_title
)
or
\
(
request_instance_tree
.
getValidationState
()
!=
"validated"
)
or
\
...
...
@@ -59,6 +67,7 @@ else:
title
=
software_title
,
destination_section
=
person
.
getRelativeUrl
(),
upgrade_scope
=
"auto"
,
follow_up_value
=
project_list
[
0
],
activate_kw
=
{
'tag'
:
tag
},
)
...
...
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