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
de964754
Commit
de964754
authored
Dec 30, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_slap_tool: Squash
parent
feae9de3
Pipeline
#19098
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
60 deletions
+7
-60
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
...onentTemplateItem/portal_components/tool.erp5.SlapTool.py
+7
-60
No files found.
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
View file @
de964754
...
...
@@ -216,25 +216,6 @@ class SlapTool(BaseTool):
# called on site
pass
def
_storeLastData
(
self
,
key
,
value
):
cache_plugin
=
self
.
getPortalObject
().
portal_caches
\
.
getRamCacheRoot
().
get
(
'last_stored_data_cache_factory'
)
\
.
getCachePluginList
()[
0
]
cache_plugin
.
set
(
key
,
DEFAULT_CACHE_SCOPE
,
value
,
cache_duration
=
self
.
getPortalObject
().
portal_caches
\
.
getRamCacheRoot
().
get
(
'last_stored_data_cache_factory'
).
cache_duration
)
def
_getLastData
(
self
,
key
):
cache_plugin
=
self
.
getPortalObject
().
portal_caches
\
.
getRamCacheRoot
().
get
(
'last_stored_data_cache_factory'
)
\
.
getCachePluginList
()[
0
]
try
:
entry
=
cache_plugin
.
get
(
key
,
DEFAULT_CACHE_SCOPE
)
except
KeyError
:
entry
=
None
else
:
entry
=
entry
.
getValue
()
return
entry
def
_activateFillComputeNodeInformationCache
(
self
,
compute_node_id
,
user
):
tag
=
'compute_node_information_cache_fill_%s_%s'
%
(
compute_node_id
,
user
)
...
...
@@ -771,11 +752,9 @@ class SlapTool(BaseTool):
"""
Fire up bung on Compute Node
"""
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
()
\
.
getUserName
()
self
.
_logAccess
(
user
,
compute_node_id
,
'#error bang'
)
return
self
.
_getComputeNodeDocument
(
compute_node_id
).
reportComputeNodeBang
(
comment
=
message
)
compute_node
=
self
.
_getComputeNodeDocument
(
compute_node_id
)
compute_node
.
setAccessStatus
(
'#error bang'
)
return
compute_node
.
reportComputeNodeBang
(
comment
=
message
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'computerBang'
)
...
...
@@ -925,34 +904,6 @@ class SlapTool(BaseTool):
# Internal methods
####################################################
def
_logAccess
(
self
,
user_reference
,
context_reference
,
text
,
state
=
""
):
memcached_dict
=
self
.
Base_getSlapToolMemcachedDict
()
previous
=
self
.
_getCachedAccessInfo
(
context_reference
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
status_changed
=
True
if
previous
is
not
None
:
previous_json
=
json
.
loads
(
previous
)
if
text
.
split
(
" "
)[
0
]
==
previous_json
.
get
(
"text"
,
""
).
split
(
" "
)[
0
]:
since
=
previous_json
.
get
(
"since"
,
previous_json
.
get
(
"created_at"
,
rfc1123_date
(
DateTime
())))
status_changed
=
False
if
state
==
""
:
state
=
previous_json
.
get
(
"state"
,
""
)
value
=
json
.
dumps
({
'user'
:
'%s'
%
user_reference
,
'created_at'
:
'%s'
%
created_at
,
'text'
:
'%s'
%
text
,
'since'
:
'%s'
%
since
,
'state'
:
state
})
memcached_dict
[
context_reference
]
=
value
return
status_changed
def
_validateXML
(
self
,
to_be_validated
,
xsd_model
):
"""Will validate the xml file"""
#We parse the XSD model
...
...
@@ -1108,9 +1059,8 @@ class SlapTool(BaseTool):
instance
=
self
.
_getSoftwareInstanceForComputePartition
(
compute_node_id
,
compute_partition_id
)
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
()
\
.
getUserName
()
status_changed
=
self
.
_logAccess
(
user
,
instance
.
getReference
(),
status_changed
=
instance
.
setAccessStatus
(
'#error while instanciating: %s'
%
error_log
[
-
80
:])
if
status_changed
:
...
...
@@ -1695,11 +1645,8 @@ class SlapTool(BaseTool):
Log the compute_node status
"""
compute_node_document
=
self
.
_getComputeNodeDocument
(
compute_node_id
)
software_installation
_reference
=
self
.
_getSoftwareInstallationReferenc
e
(
url
,
software_installation
=
self
.
_getSoftwareInstallationForComputeNod
e
(
url
,
compute_node_document
)
user
=
self
.
getPortalObject
().
portal_membership
.
\
getAuthenticatedMember
().
getUserName
()
self
.
_logAccess
(
user
,
software_installation_reference
,
'#error while installing %s'
%
url
)
software_installation
.
setAccessStatus
(
'#error while installing %s'
%
url
)
InitializeClass
(
SlapTool
)
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