Make actions work with Python3

This commit is contained in:
Sunil Mohan Adapa committed 2014-10-01 12:08:39 +05:30
1 parent e7ed0c7c58
commit ea3d72175d
1 file changed
+3 -1
+3 -1
View File
@@ -133,8 +133,9 @@ def _run(action, options=None, async=False, run_as_root=False):
# contract: 3C, 3D: don't allow users to insert escape characters in
# options
if options:
if not hasattr(options, "__iter__"):
if not isinstance(options, (list, tuple)):
options = [options]
cmd += [pipes.quote(option) for option in options]
# contract 1: commands can run via sudo.
@@ -153,6 +154,7 @@ def _run(action, options=None, async=False, run_as_root=False):
if not async:
output, error = proc.communicate()
output, error = output.decode(), error.decode()
if proc.returncode != 0:
LOGGER.error('Error executing command - %s, %s, %s', cmd, output,
error)