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
0
Merge Requests
0
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
Rafael Monnerat
slapos.core
Commits
3242ed28
Commit
3242ed28
authored
Jun 30, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Drop getComputePartitionNewsDict
parent
a23e9a04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
63 deletions
+1
-63
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
...em/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
+1
-63
No files found.
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
View file @
3242ed28
...
...
@@ -131,10 +131,6 @@ class SlapOSComputeNodeMixin(object):
# called on site
pass
# Also update cache for News Dict, so it speed up access of this UI.
key
=
'%s_partition_news'
%
self
.
getReference
()
self
.
_getCachedComputePartitionNewsDict
(
key
,
refresh_etag
)
def
_calculateRefreshEtag
(
self
):
# check max indexation timestamp
# it is unlikely to get an empty catalog
...
...
@@ -333,62 +329,4 @@ class SlapOSComputeNodeMixin(object):
raise
ValueError
(
'Wrong list of software releases on %r: %s'
%
(
self
.
getReference
(),
', '
.
join
([
q
.
getRelativeUrl
()
for
q
\
in
software_installation_list
])
))
def
getComputePartitionNewsDict
(
self
):
key
=
'%s_partition_news'
%
self
.
getReference
()
cache_plugin
=
self
.
_getCachePlugin
()
refresh_etag
=
self
.
_calculateRefreshEtag
()
try
:
entry
=
cache_plugin
.
get
(
key
,
DEFAULT_CACHE_SCOPE
)
except
KeyError
:
entry
=
None
if
entry
is
not
None
and
isinstance
(
entry
.
getValue
(),
dict
):
cached_dict
=
entry
.
getValue
()
cached_etag
=
cached_dict
.
get
(
'refresh_etag'
,
None
)
if
(
refresh_etag
!=
cached_etag
):
return
self
.
_getCachedComputePartitionNewsDict
(
key
,
refresh_etag
)
else
:
return
cached_dict
.
get
(
'data'
)
return
self
.
_getCachedComputePartitionNewsDict
(
key
,
refresh_etag
)
def
_getCachedComputePartitionNewsDict
(
self
,
key
,
refresh_etag
):
unrestrictedSearchResults
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
compute_partition_uid_list
=
[
x
.
uid
for
x
in
unrestrictedSearchResults
(
parent_uid
=
self
.
getUid
(),
validation_state
=
"validated"
,
portal_type
=
"Compute Partition"
)]
software_instance_list
=
unrestrictedSearchResults
(
portal_type
=
"Software Instance"
,
default_aggregate_uid
=
compute_partition_uid_list
,
validation_state
=
"validated"
,
group_by_list
=
[
'default_aggregate_uid'
],
select_list
=
[
'default_aggregate_uid'
,
'default_aggregate_title'
]
)
compute_partition_dict
=
{
}
for
software_instance
in
software_instance_list
:
compute_partition_dict
[
software_instance
.
default_aggregate_title
]
=
software_instance
.
getAccessStatus
()
try
:
self
.
_getCachePlugin
().
set
(
key
,
DEFAULT_CACHE_SCOPE
,
dict
(
time
=
time
.
time
(),
refresh_etag
=
refresh_etag
,
data
=
compute_partition_dict
),
cache_duration
=
self
.
getPortalObject
().
portal_caches
\
.
getRamCacheRoot
().
get
(
'compute_node_information_cache_factory'
\
).
cache_duration
)
except
(
Unauthorized
,
IndexError
):
# XXX: Unauthorized hack. Race condition of not ready setup delivery which provides
# security information shall not make this method fail, as it will be
# called later anyway
# Note: IndexError ignored, as it happend in case if full reindex is
# called on site
pass
return
compute_partition_dict
\ No newline at end of file
))
\ No newline at end of file
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