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
Thomas Leymonerie
slapos.core
Commits
317bb945
Commit
317bb945
authored
Jun 01, 2022
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_api_style: use SlapOSCatalogToolCacheMixin to get Compute Node
parent
35374446
Changes
1
Hide 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 @
317bb945
portal_type
=
data_dict
[
"portal_type"
]
portal_type
=
data_dict
[
"portal_type"
]
portal
=
context
.
getPortalObject
()
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
portal_type
==
"Software Installation"
:
if
"compute_node_id"
in
data_dict
and
"software_release_uri"
in
data_dict
:
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
:
if
compute_node
:
return
compute_node
.
getSoftwareInstallationFromUrl
(
data_dict
[
"software_release_uri"
])
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