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
Jérome Perrin
slapos.core
Commits
f3699528
Commit
f3699528
authored
Sep 24, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapgrid: Refactor slapos node report
parent
c96db48e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
22 deletions
+12
-22
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+12
-22
No files found.
slapos/grid/slapgrid.py
View file @
f3699528
...
...
@@ -1592,34 +1592,24 @@ stderr_logfile_backups=1
try
:
computer_partition_id
=
computer_partition
.
getId
()
# We want to execute all the script in the report folder
instance_path
=
os
.
path
.
join
(
self
.
instance_root
,
computer_partition
.
getId
())
report_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'report'
)
script_list_to_run
=
listifdir
(
report_path
)
instance_path
=
os
.
path
.
join
(
self
.
instance_root
,
computer_partition_id
)
# We now generate the pseudorandom name for the xml file
# and we add it in the invocation_list
f
=
tempfile
.
NamedTemporaryFile
()
name_xml
=
'%s.%s'
%
(
'slapreport'
,
os
.
path
.
basename
(
f
.
name
))
path_to_slapreport
=
os
.
path
.
join
(
instance_path
,
'var'
,
'xml_report'
,
name_xml
)
# We now generate a pseudorandom name for the report xml file
# that will be passed to the invocation list
slapreport_path
=
tempfile
.
mktemp
(
prefix
=
'slapreport.'
,
dir
=
os
.
path
.
join
(
instance_path
,
'var'
,
'xml_report'
))
# We want to execute all the script in the report folder
failed_script_list
=
[]
for
script
in
script_list_to_run
:
report_dir
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'report'
)
for
script
in
listifdir
(
report_dir
):
invocation_list
=
[]
invocation_list
.
append
(
os
.
path
.
join
(
instance_path
,
'etc'
,
'report'
,
script
))
# We add the xml_file name to the invocation_list
#f = tempfile.NamedTemporaryFile()
#name_xml = '%s.%s' % ('slapreport', os.path.basename(f.name))
#path_to_slapreport = os.path.join(instance_path, 'var', name_xml)
invocation_list
.
append
(
path_to_slapreport
)
invocation_list
.
append
(
os
.
path
.
join
(
report_dir
,
script
))
invocation_list
.
append
(
slapreport_path
)
# Dropping privileges
uid
,
gid
=
None
,
None
stat_info
=
os
.
stat
(
instance_path
)
#stat sys call to get statistics informations
uid
=
stat_info
.
st_uid
gid
=
stat_info
.
st_gid
process_handler
=
SlapPopen
(
invocation_list
,
...
...
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