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
Titouan Soulard
slapos.core
Commits
1430f10f
Commit
1430f10f
authored
Aug 19, 2022
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: ensure created Support Request is linked to a Project
parent
a1c6a25c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSupportRequest.py
...interface_workflow/script_Person_requestSupportRequest.py
+9
-1
No files found.
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSupportRequest.py
View file @
1430f10f
...
...
@@ -9,10 +9,11 @@ try:
support_request_title
=
kwargs
[
'support_request_title'
]
resource
=
kwargs
[
'support_request_resource'
]
description
=
kwargs
[
'support_request_description'
]
project_reference
=
kwargs
[
'project_reference'
]
# Aggregate can be None, so it isn't included on the kwargs
aggregate
=
kwargs
.
get
(
"support_request_aggregate"
,
None
)
except
KeyError
:
raise
TypeError
,
"Person_requestSupportRequest takes exactly
4
arguments"
raise
TypeError
,
"Person_requestSupportRequest takes exactly
5
arguments"
tag
=
"%s_%s_SupportRequestInProgress"
%
(
person
.
getUid
(),
support_request_title
)
...
...
@@ -21,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
(
"%i projects '%s'"
%
(
len
(
project_list
),
project_reference
))
support_request_portal_type
=
"Support Request"
module
=
portal
.
getDefaultModule
(
portal_type
=
support_request_portal_type
)
...
...
@@ -30,6 +37,7 @@ support_request = module.newContent(
description
=
description
,
resource
=
resource
,
destination_decision_value
=
person
,
destination_project_value
=
project_list
[
0
],
aggregate
=
aggregate
,
specialise
=
"sale_trade_condition_module/slapos_ticket_trade_condition"
,
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