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
Roque
slapos.core
Commits
3ff4a916
Commit
3ff4a916
authored
Apr 04, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Plain Diff
slapgrid: Fix promise logging with instance python
See merge request
nexedi/slapos.core!373
parents
dc8272b5
ad06784b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+9
-4
slapos/grid/utils.py
slapos/grid/utils.py
+1
-1
No files found.
slapos/grid/slapgrid.py
View file @
3ff4a916
...
@@ -726,16 +726,21 @@ stderr_logfile_backups=1
...
@@ -726,16 +726,21 @@ stderr_logfile_backups=1
else
:
else
:
command
.
append
(
'--'
+
option
)
command
.
append
(
'--'
+
option
)
command
.
append
(
str
(
value
))
command
.
append
(
str
(
value
))
# Compute timeout as the sum of all promise timeouts + empirical margin.
promises
=
plugins
+
len
(
listifdir
(
legacy_promise_dir
))
promises
=
plugins
+
len
(
listifdir
(
legacy_promise_dir
))
# Add a timeout margin to let the process kill the promises and cleanup
timeout
=
promises
*
self
.
promise_timeout
+
10
timeout
=
promises
*
self
.
promise_timeout
+
10
# The runpromise script uses stderr exclusively to propagate exception
# The runpromise script uses stderr exclusively to propagate exception
# messages. It otherwise redirects stderr to stdout so that all outputs
# messages. It otherwise redirects stderr to stdout so that all outputs
# from the promises go to stdout.
# from the promises go to stdout.
def
preexec_fn
():
err
=
os
.
dup
(
2
)
os
.
dup2
(
1
,
2
)
dropPrivileges
(
uid
,
gid
,
logger
=
self
.
logger
)
os
.
dup2
(
err
,
2
)
try
:
try
:
process
=
SlapPopen
(
process
=
SlapPopen
(
command
,
command
,
preexec_fn
=
lambda
:
dropPrivileges
(
uid
,
gid
,
logger
=
self
.
logger
)
,
preexec_fn
=
preexec_fn
,
cwd
=
instance_path
,
cwd
=
instance_path
,
universal_newlines
=
True
,
universal_newlines
=
True
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
...
@@ -749,10 +754,10 @@ stderr_logfile_backups=1
...
@@ -749,10 +754,10 @@ stderr_logfile_backups=1
elif
process
.
returncode
:
elif
process
.
returncode
:
raise
Exception
(
stderr
)
raise
Exception
(
stderr
)
elif
stderr
:
elif
stderr
:
self
.
logger
.
warn
(
'
Promise runner unexpected
output:
\
n
%s'
,
stderr
)
self
.
logger
.
warn
(
'
Unexpected promise runner
output:
\
n
%s'
,
stderr
)
except
subprocess
.
TimeoutExpired
:
except
subprocess
.
TimeoutExpired
:
killProcessTree
(
process
.
pid
,
self
.
logger
)
killProcessTree
(
process
.
pid
,
self
.
logger
)
#
The timeout margin was exceeded but this should be infrequent
#
If this happens, it might be that the timeout margin is too small.
raise
Exception
(
'Promise runner timed out'
)
raise
Exception
(
'Promise runner timed out'
)
else
:
else
:
...
...
slapos/grid/utils.py
View file @
3ff4a916
...
@@ -299,7 +299,7 @@ def dropPrivileges(uid, gid, logger):
...
@@ -299,7 +299,7 @@ def dropPrivileges(uid, gid, logger):
else
:
else
:
raise
ValueError
(
'%s it was possible to go back to uid = %r and gid = '
raise
ValueError
(
'%s it was possible to go back to uid = %r and gid = '
'%r which is fatal.'
%
(
message_pre
,
current_uid
,
current_gid
))
'%r which is fatal.'
%
(
message_pre
,
current_uid
,
current_gid
))
logger
.
debug
(
'Succesfully dropped privileges to uid=%r gid=%r'
%
(
uid
,
gid
))
logger
.
debug
(
'Succes
s
fully dropped privileges to uid=%r gid=%r'
%
(
uid
,
gid
))
def
bootstrapBuildout
(
path
,
logger
,
buildout
=
None
,
def
bootstrapBuildout
(
path
,
logger
,
buildout
=
None
,
...
...
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