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
Rafael Monnerat
slapos.core
Commits
61d57f57
Commit
61d57f57
authored
Jan 27, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: x
parent
db4f0d88
Pipeline
#19489
failed with stage
in 0 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
175 deletions
+20
-175
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
...lateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
+12
-4
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSlapToolMemcachedDict.py
...ortal_skins/slapos_cloud/Base_getSlapToolMemcachedDict.py
+0
-7
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSlapToolMemcachedDict.xml
...rtal_skins/slapos_cloud/Base_getSlapToolMemcachedDict.xml
+0
-62
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_checkAndUpdateCapacityScope.py
...s/slapos_cloud/ComputeNode_checkAndUpdateCapacityScope.py
+2
-6
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_getLastContactDate.py
...rtal_skins/slapos_cloud/ComputeNode_getLastContactDate.py
+0
-12
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_getLastContactDate.xml
...tal_skins/slapos_cloud/ComputeNode_getLastContactDate.xml
+0
-62
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_viewCurrentUsageReport/my_last_contact_date.xml
...mputeNode_viewCurrentUsageReport/my_last_contact_date.xml
+1
-1
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_getLastestContactedDate.py
.../slapos_cloud/ComputePartition_getLastestContactedDate.py
+4
-20
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_viewComputeNodeList/listbox_latest_contact_date.xml
...twork_viewComputeNodeList/listbox_latest_contact_date.xml
+1
-1
No files found.
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
View file @
61d57f57
...
...
@@ -37,7 +37,6 @@ import json
class
SlapOSCacheMixin
:
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
...
...
@@ -61,9 +60,6 @@ class SlapOSCacheMixin:
return
None
return
data
def
getTextAccessStatus
(
self
):
return
self
.
getAccessStatus
()[
'text'
]
def
getAccessStatus
(
self
):
data_json
=
self
.
_getCachedAccessInfo
()
last_modified
=
rfc1123_date
(
DateTime
())
...
...
@@ -121,6 +117,18 @@ class SlapOSCacheMixin:
memcached_dict
[
self
.
getReference
()]
=
value
return
status_changed
def
getTextAccessStatus
(
self
):
return
self
.
getAccessStatus
()[
'text'
]
def
getLastAccessDate
(
self
):
data_dict
=
self
.
getAccessStatus
()
if
data_dict
.
get
(
"no_data"
)
==
1
:
return
"%s didn't contact the server"
%
self
.
getPortalType
()
date
=
DateTime
(
data_dict
[
'created_at'
])
return
date
.
strftime
(
'%Y/%m/%d %H:%M'
)
#####################
# SlapOS Last Data
#####################
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSlapToolMemcachedDict.py
deleted
100644 → 0
View file @
db4f0d88
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
return
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSlapToolMemcachedDict.xml
deleted
100644 → 0
View file @
db4f0d88
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getSlapToolMemcachedDict
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_checkAndUpdateCapacityScope.py
View file @
61d57f57
import
json
compute_node
=
context
portal
=
context
.
getPortalObject
()
from
zExceptions
import
Unauthorized
...
...
@@ -22,14 +21,11 @@ comment = ''
if
can_allocate
:
# Check if compute_node has error reported
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
try
:
d
=
memcached_dict
[
compute_node
.
getReference
()]
except
KeyError
:
log_dict
=
compute_node
.
getAccessStatus
()
if
log_dict
.
get
(
"no_data"
)
==
1
:
can_allocate
=
False
comment
=
"Compute Node didn't contact the server"
else
:
log_dict
=
json
.
loads
(
d
)
if
'#error'
in
log_dict
.
get
(
'text'
,
'#error'
):
can_allocate
=
False
comment
=
'Compute Node reported an error'
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_getLastContactDate.py
deleted
100644 → 0
View file @
db4f0d88
from
DateTime
import
DateTime
import
json
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
try
:
d
=
memcached_dict
[
context
.
getReference
()]
except
KeyError
:
return
"Compute Node didn't contact the server"
else
:
log_dict
=
json
.
loads
(
d
)
date
=
DateTime
(
log_dict
[
'created_at'
])
return
date
.
strftime
(
'%Y/%m/%d %H:%M'
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_getLastContactDate.xml
deleted
100644 → 0
View file @
db4f0d88
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComputeNode_getLastContactDate
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputeNode_viewCurrentUsageReport/my_last_contact_date.xml
View file @
61d57f57
...
...
@@ -125,7 +125,7 @@
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: context.
ComputeNode_getLastContact
Date()
</string>
</value>
<value>
<string>
python: context.
getLastAccess
Date()
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_getLastestContactedDate.py
View file @
61d57f57
from
DateTime
import
DateTime
import
json
partition
=
context
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
result
=
""
date
=
None
for
si
in
partition
.
getAggregateRelatedValueList
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
]):
for
si
in
context
.
getAggregateRelatedValueList
(
portal_type
=
[
"Software Instance"
]):
obj
=
si
.
getObject
()
if
obj
.
getValidationState
()
!=
"validated"
:
...
...
@@ -15,13 +6,6 @@ for si in partition.getAggregateRelatedValueList(portal_type=["Software Instance
if
obj
.
getSlapState
()
==
"destroy_requested"
:
continue
try
:
d
=
memcached_dict
[
obj
.
getReference
()]
except
KeyError
:
result
=
"#missing no data found for %s"
%
obj
.
getReference
()
else
:
d
=
json
.
loads
(
d
)
date
=
DateTime
(
d
[
'created_at'
])
result
=
date
.
strftime
(
'%Y/%m/%d %H:%M'
)
return
result
return
obj
.
getLastAccessDate
()
return
""
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_viewComputeNodeList/listbox_latest_contact_date.xml
View file @
61d57f57
...
...
@@ -134,7 +134,7 @@
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
cell/
ComputeNode_getLastContact
Date
</string>
</value>
<value>
<string>
cell/
getLastAccess
Date
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
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