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
64ddbf8d
Commit
64ddbf8d
authored
Nov 02, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel: do not create multiple Instance Node from an Instance Tree
parent
6b01fd58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/InstanceTree_addSlapOSInstanceNode.py
..._skins/slapos_panel/InstanceTree_addSlapOSInstanceNode.py
+25
-2
No files found.
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/InstanceTree_addSlapOSInstanceNode.py
View file @
64ddbf8d
...
@@ -2,14 +2,37 @@ from Products.ERP5Type.Message import translateString
...
@@ -2,14 +2,37 @@ from Products.ERP5Type.Message import translateString
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
instance_tree
=
context
instance_tree
=
context
software_instance
=
instance_tree
.
getSuccessorValue
(
portal_type
=
'Software Instance'
)
software_instance
=
instance_tree
.
getSuccessorValue
(
portal_type
=
'Software Instance'
)
# If an Instance Node already exist, do nothing
instance_node
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Instance Node"
,
specialise__uid
=
software_instance
.
getUid
()
)
if
(
instance_node
is
not
None
):
return
instance_node
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
translateString
(
'Instance Node already created.'
)
}
)
# If an Instance Node is not yet indexed, do nothing
tag
=
"%s_createInstanceNode"
%
instance_tree
.
getUid
()
if
(
0
<
portal
.
portal_activities
.
countMessageWithTag
(
tag
)):
# The instance node is already under creation but can not be fetched from catalog
return
instance_tree
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
translateString
(
'New Instance Node under creation.'
)
}
)
instance_node
=
portal
.
compute_node_module
.
newContent
(
instance_node
=
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Instance Node'
,
portal_type
=
'Instance Node'
,
title
=
instance_tree
.
getTitle
(),
title
=
instance_tree
.
getTitle
(),
specialise_value
=
software_instance
,
specialise_value
=
software_instance
,
follow_up_value
=
software_instance
.
getFollowUpValue
()
follow_up_value
=
software_instance
.
getFollowUpValue
(),
activate_kw
=
{
'tag'
:
tag
}
)
)
instance_node
.
validate
()
instance_node
.
validate
()
...
...
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