[node-patches] Change in ovirt-node[master]: process: Make use of shell explicit

mburns at redhat.com mburns at redhat.com
Mon Jul 15 14:44:59 UTC 2013


Michael Burns has submitted this change and it was merged.

Change subject: process: Make use of shell explicit
......................................................................


process: Make use of shell explicit

Previously some methods in the process module implicitly used the shell
keyword-argument, some others didn't.
If the shell=True arg is used, then Popen will allow and interprete a
string as the cmd, e.g. "ls /tmp" and will do the right thing. If
shell=False the Popen will look for a command named "ls /tmp". Because
in the case of shell=False, Popen expects a list, the first item in the
list beeing the command itself, and the subsequent items beeing
arguments to that command.

This patch removes the implicit use if shell=True to have the same usage
pattern accross all functions in the process module.
This prepares to solve problems e.g. related to kdump.

Summarized:
Args need to be a list in the default (shell=False) case:
process.call(["ls", "/tmp"])
This is a save way of calling a function with arguments, because quoting
the args is done by python.

Args need to be a string in the shell=True case:
process.call("ls /tmp | grep something", shell=True)
The string will be interpreted by a shell, thus all shell features can
be used in that string, but also quotation is up to the user and
therefor considered as unsafe.

Change-Id: I3cbc920e07fd4c3890028fe2f2d006e1be7c2ae6
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/app.py
M src/ovirt/node/config/defaults.py
M src/ovirt/node/config/network.py
M src/ovirt/node/setup/cim/cim_model.py
M src/ovirt/node/setup/core/diagnostics_page.py
M src/ovirt/node/setup/core/kdump_page.py
M src/ovirt/node/setup/core/ping.py
M src/ovirt/node/setup/core/support_page.py
M src/ovirt/node/setup/puppet/puppet_page.py
M src/ovirt/node/setup/snmp/snmp_model.py
M src/ovirt/node/utils/console.py
M src/ovirt/node/utils/network.py
M src/ovirt/node/utils/process.py
M src/ovirt/node/utils/security.py
M src/ovirt/node/utils/system.py
M src/ovirt/node/utils/tuned.py
M src/ovirtnode/ovirtfunctions.py
17 files changed, 69 insertions(+), 55 deletions(-)

Approvals:
  Fabian Deutsch: Verified; Looks good to me, approved
  Michael Burns: 


-- 
To view, visit http://gerrit.ovirt.org/16665
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3cbc920e07fd4c3890028fe2f2d006e1be7c2ae6
Gerrit-PatchSet: 10
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: Michael Burns <mburns at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the node-patches mailing list