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
Eric Zheng
slapos.core
Commits
4a2b71b8
Commit
4a2b71b8
authored
Jan 16, 2015
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supervisord: allow to start with --nodaemon.
parent
b05433d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
slapos/cli/supervisord.py
slapos/cli/supervisord.py
+14
-1
slapos/grid/svcbackend.py
slapos/grid/svcbackend.py
+10
-5
No files found.
slapos/cli/supervisord.py
View file @
4a2b71b8
...
@@ -39,9 +39,22 @@ class SupervisordCommand(ConfigCommand):
...
@@ -39,9 +39,22 @@ class SupervisordCommand(ConfigCommand):
"""
"""
command_group
=
'node'
command_group
=
'node'
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
SupervisordCommand
,
self
).
get_parser
(
prog_name
)
ap
.
add_argument
(
'-n'
,
'--nodaemon'
,
action
=
'store_true'
,
help
=
'Do not daemonize supervisord'
)
return
ap
def
take_action
(
self
,
args
):
def
take_action
(
self
,
args
):
configp
=
self
.
fetch_config
(
args
)
configp
=
self
.
fetch_config
(
args
)
instance_root
=
configp
.
get
(
'slapos'
,
'instance_root'
)
instance_root
=
configp
.
get
(
'slapos'
,
'instance_root'
)
if
args
.
nodaemon
:
supervisord_additional_argument_list
=
[
'--nodaemon'
]
else
:
supervisord_additional_argument_list
=
[]
launchSupervisord
(
socket
=
os
.
path
.
join
(
instance_root
,
'supervisord.socket'
),
launchSupervisord
(
socket
=
os
.
path
.
join
(
instance_root
,
'supervisord.socket'
),
configuration_file
=
os
.
path
.
join
(
instance_root
,
'etc'
,
'supervisord.conf'
),
configuration_file
=
os
.
path
.
join
(
instance_root
,
'etc'
,
'supervisord.conf'
),
logger
=
self
.
app
.
log
)
logger
=
self
.
app
.
log
,
supervisord_additional_argument_list
=
supervisord_additional_argument_list
)
slapos/grid/svcbackend.py
View file @
4a2b71b8
...
@@ -47,7 +47,7 @@ def getSupervisorRPC(socket):
...
@@ -47,7 +47,7 @@ def getSupervisorRPC(socket):
return
getattr
(
server_proxy
,
'supervisor'
)
return
getattr
(
server_proxy
,
'supervisor'
)
def
launchSupervisord
(
socket
,
configuration_file
,
logger
):
def
launchSupervisord
(
socket
,
configuration_file
,
logger
,
supervisord_additional_argument_list
=
None
):
if
os
.
path
.
exists
(
socket
):
if
os
.
path
.
exists
(
socket
):
trynum
=
1
trynum
=
1
while
trynum
<
6
:
while
trynum
<
6
:
...
@@ -76,13 +76,18 @@ def launchSupervisord(socket, configuration_file, logger):
...
@@ -76,13 +76,18 @@ def launchSupervisord(socket, configuration_file, logger):
logger
.
warning
(
log_message
)
logger
.
warning
(
log_message
)
break
break
supervisord_argument_list
=
[
'-c'
,
configuration_file
]
if
supervisord_additional_argument_list
is
not
None
:
supervisord_argument_list
.
extend
(
supervisord_additional_argument_list
)
logger
.
info
(
"Launching supervisord with clean environment."
)
logger
.
info
(
"Launching supervisord with clean environment."
)
# Extract python binary to prevent shebang size limit
# Extract python binary to prevent shebang size limit
invocation_list
=
[
"supervisord"
,
'-c'
]
invocation_list
=
[
"supervisord"
,
'-c'
]
invocation_list
.
append
(
"import sys ; sys.path="
+
str
(
sys
.
path
)
+
" ; import "
invocation_list
.
append
(
"supervisor.supervisord ; sys.argv[1:1]=['-c','"
+
"import sys ; sys.path="
+
str
(
sys
.
path
)
+
" ; "
+
configuration_file
+
"import supervisor.supervisord ; "
+
"'] ; supervisor.supervisord.main()"
)
"sys.argv[1:1]="
+
str
(
supervisord_argument_list
)
+
" ; "
+
"supervisor.supervisord.main()"
)
supervisord_popen
=
SlapPopen
(
invocation_list
,
supervisord_popen
=
SlapPopen
(
invocation_list
,
env
=
{},
env
=
{},
executable
=
sys
.
executable
,
executable
=
sys
.
executable
,
...
...
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