diff --git a/src/bin/composer b/src/bin/composer index 2b46e949..4914f4a2 100755 --- a/src/bin/composer +++ b/src/bin/composer @@ -23,9 +23,11 @@ log = logging.getLogger("composer") import os import sys -from composer import vernum -from composer.cli import main -from composer.cli.cmdline import composer_cli_parser +# Disable pylint warnings for these, because it cannot deal with this file and +# the module both being called "composer" +from composer import vernum # pylint: disable=import-self +from composer.cli import main # pylint: disable=no-name-in-module +from composer.cli.cmdline import composer_cli_parser # pylint: disable=no-name-in-module VERSION = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum) diff --git a/src/pylorax/executils.py b/src/pylorax/executils.py index 19e0228a..4cbd4b9c 100644 --- a/src/pylorax/executils.py +++ b/src/pylorax/executils.py @@ -115,6 +115,7 @@ def startProgram(argv, root='/', stdin=None, stdout=subprocess.PIPE, stderr=subp if env_add: env.update(env_add) + # pylint: disable=subprocess-popen-preexec-fn return subprocess.Popen(argv, stdin=stdin, stdout=stdout, diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py index 5c5e3cf5..9e88fbb3 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -196,10 +196,7 @@ def loop_attach(outfile): # Sometimes the loop device isn't ready yet, make extra sure before returning loop_waitfor(dev, outfile) - except CalledProcessError: - # Problems running losetup are always errors, raise immediately - raise - except RuntimeError as e: + except RuntimeError: # Try to setup the loop device 3 times if retries == 3: logger.error("loop_attach failed, retries exhausted.") diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index 016f4b2e..71d4b2cb 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -248,10 +248,10 @@ class LoraxTemplateRunner(object): # skip the bit about "ltmpl.py, in _run()" - we know that exclines.pop(1) # log the "ErrorType: this is what happened" line - logger.error(" " + exclines[-1].strip()) + logger.error(" %s", exclines[-1].strip()) # and log the entire traceback to the debug log for _line in ''.join(exclines).splitlines(): - logger.debug(" " + _line) + logger.debug(" %s", _line) if self.fatalerrors: raise diff --git a/tests/pylint/runpylint.py b/tests/pylint/runpylint.py index 3e200f97..be47f226 100755 --- a/tests/pylint/runpylint.py +++ b/tests/pylint/runpylint.py @@ -9,9 +9,6 @@ class LoraxLintConfig(PocketLintConfig): PocketLintConfig.__init__(self) self.falsePositives = [ FalsePositive(r"Module 'pylorax' has no 'version' member"), - # threading.Lock() is a factory function which returns an - # instance of the Lock class that is supported by the platform - FalsePositive(r"Context manager 'lock' doesn't implement __enter__ and __exit__"), FalsePositive(r"Catching too general exception Exception"), FalsePositive(r"^E0712.*: Catching an exception which doesn't inherit from (Base|)Exception: GError$"), FalsePositive(r"Module 'composer' has no 'version' member"),