Fixes bug #1556995 - fuel-agent fails to set process group over SSH
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 <d6e0e5c3b4a843824d922e1d502b6f6e375bb604@gmail.com>

openstack/bareon,openstack/bareon