From f8318f8eec9c8f1c1676ce6a5b5c2c77fa2f7cc5 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 19 Mar 2013 09:06:31 -0400 Subject: pylint fixes a.) appease pylint on raring, as it doesn't like subprocess pylint: 0.26.0-1ubuntu1 This is mentioned in comments at http://www.logilab.org/ticket/46273 b.) tests/unittests/test_util.py: the mountinfo lines are longer than 80 chars. Just disable long lines complaints for this file. --- cloudinit/config/cc_power_state_change.py | 2 +- cloudinit/util.py | 6 +++--- setup.py | 5 +++-- tests/unittests/test_util.py | 2 ++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index de0c0bbd..188047e5 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -100,7 +100,7 @@ def execmd(exe_args, output=None, data_in=None): proc = subprocess.Popen(exe_args, stdin=subprocess.PIPE, stdout=output, stderr=subprocess.STDOUT) proc.communicate(data_in) - ret = proc.returncode + ret = proc.returncode # pylint: disable=E1101 except Exception: doexit(EXIT_FAIL) doexit(ret) diff --git a/cloudinit/util.py b/cloudinit/util.py index 10297ca2..636ed20e 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -462,7 +462,7 @@ def redirect_output(outfmt, errfmt, o_out=None, o_err=None): new_fp = open(arg, owith) elif mode == "|": proc = subprocess.Popen(arg, shell=True, stdin=subprocess.PIPE) - new_fp = proc.stdin + new_fp = proc.stdin # pylint: disable=E1101 else: raise TypeError("Invalid type for output format: %s" % outfmt) @@ -484,7 +484,7 @@ def redirect_output(outfmt, errfmt, o_out=None, o_err=None): new_fp = open(arg, owith) elif mode == "|": proc = subprocess.Popen(arg, shell=True, stdin=subprocess.PIPE) - new_fp = proc.stdin + new_fp = proc.stdin # pylint: disable=E1101 else: raise TypeError("Invalid type for error format: %s" % errfmt) @@ -1409,7 +1409,7 @@ def subp(args, data=None, rcs=None, env=None, capture=True, shell=False, (out, err) = sp.communicate(data) except OSError as e: raise ProcessExecutionError(cmd=args, reason=e) - rc = sp.returncode + rc = sp.returncode # pylint: disable=E1101 if rc not in rcs: raise ProcessExecutionError(stdout=out, stderr=err, exit_code=rc, diff --git a/setup.py b/setup.py index b30cd53b..4aa1a47c 100755 --- a/setup.py +++ b/setup.py @@ -61,9 +61,10 @@ def tiny_p(cmd, capture=True): sp = subprocess.Popen(cmd, stdout=stdout, stderr=stderr, stdin=None) (out, err) = sp.communicate() - if sp.returncode not in [0]: + ret = sp.returncode # pylint: disable=E1101 + if ret not in [0]: raise RuntimeError("Failed running %s [rc=%s] (%s, %s)" - % (cmd, sp.returncode, out, err)) + % (cmd, ret, out, err)) return (out, err) diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 7ff9a57f..5853cb0f 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -1,3 +1,5 @@ +# pylint: disable=C0301 +# the mountinfo data lines are too long import os import stat import yaml -- cgit v1.2.3