Change in vdsm[master]: utils: add logged CPopen command execution

nsoffer at redhat.com nsoffer at redhat.com
Fri Mar 20 13:47:58 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: utils: add logged CPopen command execution
......................................................................


Patch Set 2: Code-Review-1

(2 comments)

https://gerrit.ovirt.org/#/c/38831/2/lib/vdsm/utils.py
File lib/vdsm/utils.py:

Line 640:         parts.append(arg)
Line 641:     return ' '.join(parts)
Line 642: 
Line 643: 
Line 644: def loggedCPopen(args, close_fds=False, cwd=None, env=None, deathSignal=0,
This use by default close_fds=False, but execCmd always closed the fds. So now we will have code that uses close_fds=False by mistake, forgetting to set this useful option.

I think we should keep the current behavior and and use close_fds=True as default. CPopen try to be compatible with Popen, but we don't have this requirement, and can use a safer default.
Line 645:                  childUmask=None, printable=None, logger=logging.root,
Line 646:                  level=logging.DEBUG):
Line 647:     if not printable:
Line 648:         printable = args


Line 684:         command = tuple(command)
Line 685: 
Line 686:     p = loggedCPopen(command, close_fds=True, cwd=cwd, env=env,
Line 687:                      deathSignal=deathSignal, childUmask=childUmask,
Line 688:                      printable=printable, execCmdLogger=logging.root)
You must pass the logger the user asked for, not logging.root.
Line 689:     if not sync:
Line 690:         p = AsyncProc(p)
Line 691:         if data is not None:
Line 692:             p.stdin.write(data)


-- 
To view, visit https://gerrit.ovirt.org/38831
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I5e04bde10be24457fe12362456e42528f9fd7196
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list