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
Labels
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
8a2cc912
Commit
8a2cc912
authored
Jun 01, 2022
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Mar 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_api_style: use SlapOSCatalogToolCacheMixin to get Compute Node
parent
67137d32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
23 deletions
+4
-23
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_getObjectFromData.py
...l_skins/slapos_jio_api/jIOWebSection_getObjectFromData.py
+4
-23
No files found.
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_getObjectFromData.py
View file @
8a2cc912
portal_type
=
data_dict
[
"portal_type"
]
portal
=
context
.
getPortalObject
()
### Start of Duplicated code for getting documents the SlapOS way"
from
Products.ERP5Type.Cache
import
CachingMethod
def
_getNonCachedComputeNodeDocumentUrl
(
compute_node_reference
):
return
context
.
Base_getUnrestrictedDocumentUrl
(
portal_type
=
'Compute Node'
,
# XXX Hardcoded validation state
validation_state
=
"validated"
,
reference
=
compute_node_reference
)
def
_getComputeNodeDocument
(
compute_node_reference
):
"""
Get the validated compute_node with this reference.
"""
result
=
CachingMethod
(
_getNonCachedComputeNodeDocumentUrl
,
id
=
'_getComputeNodeDocument'
,
cache_factory
=
'slap_cache_factory'
)(
compute_node_reference
)
if
result
:
return
portal
.
restrictedTraverse
(
result
)
return
None
if
portal_type
==
"Software Installation"
:
if
"compute_node_id"
in
data_dict
and
"software_release_uri"
in
data_dict
:
compute_node
=
_getComputeNodeDocument
(
data_dict
[
"compute_node_id"
])
compute_node
=
portal
.
portal_catalog
.
getComputeNodeObject
(
data_dict
[
"compute_node_id"
],
raise_not_found
=
False
,
)
if
compute_node
:
return
compute_node
.
getSoftwareInstallationFromUrl
(
data_dict
[
"software_release_uri"
])
...
...
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