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
Léo-Paul Géneau
slapos.core
Commits
5591f894
Commit
5591f894
authored
Nov 28, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapgrid: Adapt launching promise with SlapPopen
parent
0fe309cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
24 deletions
+21
-24
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+21
-24
No files found.
slapos/grid/slapgrid.py
View file @
5591f894
...
@@ -59,7 +59,11 @@ from slapos import manager as slapmanager
...
@@ -59,7 +59,11 @@ from slapos import manager as slapmanager
from
slapos.slap.slap
import
NotFoundError
from
slapos.slap.slap
import
NotFoundError
from
slapos.slap.slap
import
ServerError
from
slapos.slap.slap
import
ServerError
from
slapos.slap.slap
import
COMPUTER_PARTITION_REQUEST_LIST_TEMPLATE_FILENAME
from
slapos.slap.slap
import
COMPUTER_PARTITION_REQUEST_LIST_TEMPLATE_FILENAME
from
slapos.util
import
mkdir_p
,
chownDirectory
,
string_to_boolean
,
listifdir
from
slapos.util
import
(
mkdir_p
,
chownDirectory
,
string_to_boolean
,
listifdir
,
unicode2str
)
from
slapos.grid.exception
import
BuildoutFailedError
from
slapos.grid.exception
import
BuildoutFailedError
from
slapos.grid.SlapObject
import
Software
,
Partition
from
slapos.grid.SlapObject
import
Software
,
Partition
from
slapos.grid.svcbackend
import
(
launchSupervisord
,
from
slapos.grid.svcbackend
import
(
launchSupervisord
,
...
@@ -68,7 +72,6 @@ from slapos.grid.svcbackend import (launchSupervisord,
...
@@ -68,7 +72,6 @@ from slapos.grid.svcbackend import (launchSupervisord,
_getSupervisordSocketPath
)
_getSupervisordSocketPath
)
from
slapos.grid.utils
import
(
md5digest
,
from
slapos.grid.utils
import
(
md5digest
,
dropPrivileges
,
dropPrivileges
,
killProcessTree
,
SlapPopen
,
SlapPopen
,
updateFile
)
updateFile
)
from
slapos.grid.promise
import
PromiseLauncher
,
PromiseError
from
slapos.grid.promise
import
PromiseLauncher
,
PromiseError
...
@@ -738,28 +741,22 @@ stderr_logfile_backups=1
...
@@ -738,28 +741,22 @@ stderr_logfile_backups=1
os
.
dup2
(
1
,
2
)
os
.
dup2
(
1
,
2
)
dropPrivileges
(
uid
,
gid
,
logger
=
self
.
logger
)
dropPrivileges
(
uid
,
gid
,
logger
=
self
.
logger
)
os
.
dup2
(
err
,
2
)
os
.
dup2
(
err
,
2
)
try
:
process
=
SlapPopen
(
process
=
SlapPopen
(
command
,
command
,
preexec_fn
=
preexec_fn
,
preexec_fn
=
preexec_fn
,
cwd
=
instance_path
,
cwd
=
instance_path
,
universal_newlines
=
True
,
universal_newlines
=
True
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
logger
=
self
.
logger
,
logger
=
self
.
logger
,
timeout
=
timeout
,
timeout
=
timeout
,
)
)
if
process
.
returncode
==
2
:
stderr
=
process
.
stderr
.
read
()
raise
PromiseError
(
unicode2str
(
process
.
error
))
if
process
.
returncode
==
2
:
elif
process
.
returncode
:
raise
PromiseError
(
stderr
)
raise
Exception
(
unicode2str
(
process
.
error
))
elif
process
.
returncode
:
elif
process
.
error
:
raise
Exception
(
stderr
)
self
.
logger
.
warn
(
'Unexpected promise runner output:
\
n
%s'
,
process
.
error
)
elif
stderr
:
self
.
logger
.
warn
(
'Unexpected promise runner output:
\
n
%s'
,
stderr
)
except
subprocess
.
TimeoutExpired
:
killProcessTree
(
process
.
pid
,
self
.
logger
)
# If this happens, it might be that the timeout margin is too small.
raise
Exception
(
'Promise runner timed out'
)
else
:
else
:
return
PromiseLauncher
(
config
=
promise_config
,
logger
=
self
.
logger
).
run
()
return
PromiseLauncher
(
config
=
promise_config
,
logger
=
self
.
logger
).
run
()
...
...
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