Fixes bug #1556995 - fuel-agent fails to set process group over SSH
The issue is fixed with the following changes (as suggested by a-gordeev): fuel-agent must try to execute`os.setpgrp()` only if the PID != PGID. This piece of code covers all cases: 1) executing over SSH. It can't do os.setpgrp() over SSH as the executed script is already a session leader. It will throw EPERM (Operation not permitted). It's the actual reason of the bug. 2) executing locally over shell. It can do os.setpgrp(), the script is a process group leader, but not a session leader. 3) executing over mcollective. It must perform os.setpgrp() as the script is neither a session leader, nor a process group leader. incorporated review comments by a-gordeev, updated use cases as req by Denis. Closes-Bug: #1556995 Change-Id: I29a20e0fdfd80c6b055fc1ebb1c7007e8f69e5eb Signed-off-by: Anil Shashikumar Belur <askb23@gmail.com>
This commit is contained in:
parent
7565ae5d80
commit
b6f7ee6935
@ -136,7 +136,10 @@ def handle_exception(exc):
|
||||
def main(actions=None):
|
||||
# NOTE(agordeev): get its own process group by calling setpgrp.
|
||||
# Process group is used to distribute signals to subprocesses.
|
||||
os.setpgrp()
|
||||
# The main application is already a process group leader,
|
||||
# then there's no need to call os.setpgrp
|
||||
if os.getpid() != os.getpgrp():
|
||||
os.setpgrp()
|
||||
signal.signal(signal.SIGTERM, handle_sigterm)
|
||||
CONF(sys.argv[1:], project='bareon',
|
||||
version=version.version_info.release_string())
|
||||
|
Loading…
x
Reference in New Issue
Block a user