From 439e72b36f66855cfb66de111147a4b92e80da19 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 11 Mar 2013 08:01:39 -0400 Subject: added PEP-8 style checks to test suite --- src/sbin/bcfg2-admin | 1 + src/sbin/bcfg2-crypt | 2 +- src/sbin/bcfg2-info | 3 +-- src/sbin/bcfg2-server | 3 ++- src/sbin/bcfg2-test | 12 +++++++++--- src/sbin/bcfg2-yum-helper | 4 ++-- 6 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/sbin') diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin index fa4307702..31e49c00b 100755 --- a/src/sbin/bcfg2-admin +++ b/src/sbin/bcfg2-admin @@ -10,6 +10,7 @@ import Bcfg2.Options import Bcfg2.Server.Admin from Bcfg2.Compat import StringIO + def mode_import(modename): """Load Bcfg2.Server.Admin..""" modname = modename.capitalize() diff --git a/src/sbin/bcfg2-crypt b/src/sbin/bcfg2-crypt index fde6af582..eae316da5 100755 --- a/src/sbin/bcfg2-crypt +++ b/src/sbin/bcfg2-crypt @@ -261,7 +261,7 @@ class Encryptor(object): (self.pname, pname)) return (passphrase, pname) - def _get_passphrase(self, chunk): # pylint: disable=W0613 + def _get_passphrase(self, chunk): # pylint: disable=W0613 """ get the passphrase for a chunk of a file """ return None diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index fa8c89b46..311784606 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -474,7 +474,7 @@ Bcfg2 client itself.""") ('Password', self.setup['password']), ('Server Metadata Connector', self.setup['mconnect']), ('Filemonitor', self.setup['filemonitor']), - ('Server address', self.setup['location']), + ('Server address', self.setup['location']), ('Path to key', self.setup['key']), ('Path to SSL certificate', self.setup['cert']), ('Path to SSL CA certificate', self.setup['ca']), @@ -727,7 +727,6 @@ Bcfg2 client itself.""") pass - def build_usage(): """ build usage message """ cmd_blacklist = ["do_loop", "do_EOF"] diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server index 8322edeaa..cdca71e74 100755 --- a/src/sbin/bcfg2-server +++ b/src/sbin/bcfg2-server @@ -11,6 +11,7 @@ from Bcfg2.Server.Core import CoreInitError LOGGER = logging.getLogger('bcfg2-server') + def main(): optinfo = dict() optinfo.update(Bcfg2.Options.CLI_COMMON_OPTIONS) @@ -22,7 +23,7 @@ def main(): if not os.path.exists(setup['configfile']): print("Could not read %s" % setup['configfile']) sys.exit(1) - + if setup['backend'] not in ['best', 'cherrypy', 'builtin']: print("Unknown server backend %s, using 'best'" % setup['backend']) setup['backend'] = 'best' diff --git a/src/sbin/bcfg2-test b/src/sbin/bcfg2-test index 3dcad8689..4a57fa42f 100755 --- a/src/sbin/bcfg2-test +++ b/src/sbin/bcfg2-test @@ -5,7 +5,6 @@ without failures""" import os import sys -import signal import fnmatch import logging import Bcfg2.Logger @@ -26,7 +25,7 @@ except ImportError: class CapturingLogger(object): """ Fake logger that captures logging output so that errors are only displayed for clients that fail tests """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs): # pylint: disable=W0613 self.output = [] def error(self, msg): @@ -46,6 +45,7 @@ class CapturingLogger(object): self.output.append(msg) def reset_output(self): + """ Reset the captured output """ self.output = [] @@ -182,7 +182,8 @@ def run_child(setup, clients, queue): core.shutdown() -def main(): +def parse_args(): + """ Parse command line arguments. """ optinfo = dict(Bcfg2.Options.TEST_COMMON_OPTIONS) optinfo.update(Bcfg2.Options.CLI_COMMON_OPTIONS) optinfo.update(Bcfg2.Options.SERVER_COMMON_OPTIONS) @@ -230,7 +231,12 @@ def main(): pass if xunitfile and not setup['xunit']: setup['xunit'] = xunitfile + return setup + +def main(): + setup = parse_args() + logger = logging.getLogger(sys.argv[0]) core = get_core(setup) if setup['args']: diff --git a/src/sbin/bcfg2-yum-helper b/src/sbin/bcfg2-yum-helper index ba6f30406..7e5c03fd5 100755 --- a/src/sbin/bcfg2-yum-helper +++ b/src/sbin/bcfg2-yum-helper @@ -129,7 +129,7 @@ class DepSolver(object): err = sys.exc_info()[1] self.logger.warning(err) return [] - + if ptype == "default": return [p for p, d in list(group.default_packages.items()) @@ -254,6 +254,6 @@ def main(): rv[gdata['group']] = list(packages) print(json.dumps(rv)) - + if __name__ == '__main__': sys.exit(main()) -- cgit v1.2.3-1-g7c22