From 0f7edd60e67d32438a8be42002faacde4e4a7649 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 9 Aug 2013 16:45:45 -0400 Subject: testsuite: fixed most pylint complaints --- src/lib/Bcfg2/Server/Plugins/Packages/Collection.py | 1 - src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 1 - src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py | 17 ++++++++++++++++- src/lib/Bcfg2/Server/Plugins/Packages/__init__.py | 3 ++- 4 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py index 0df8624f6..8b20df58a 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py @@ -595,7 +595,6 @@ def get_collection_class(source_type): :type source_type: string :returns: type - the Collection subclass that should be used to instantiate an object to contain sources of the given type. """ - cls = None for mod in Bcfg2.Options.setup.packages_backends: if mod.__name__.endswith(".%s" % source_type.title()): return getattr(mod, "%sCollection" % source_type.title()) diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index e1659dbb3..4b6130f72 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -49,7 +49,6 @@ in your ``Source`` subclass. For an example of this kind of import os import re import sys -import Bcfg2.Server.Plugin from Bcfg2.Logger import Debuggable from Bcfg2.Compat import HTTPError, HTTPBasicAuthHandler, \ HTTPPasswordMgrWithDefaultRealm, install_opener, build_opener, urlopen, \ diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py b/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py index 32db0b32d..dcb8718a0 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py @@ -266,6 +266,8 @@ class CacheManager(YumHelper): class HelperSubcommand(Bcfg2.Options.Subcommand): + """ Base class for all yum helper subcommands """ + # the value to JSON encode and print out if the command fails fallback = None @@ -300,10 +302,14 @@ class HelperSubcommand(Bcfg2.Options.Subcommand): return 0 def _run(self, setup, data): + """ Actually run the command """ raise NotImplementedError class DepSolverSubcommand(HelperSubcommand): + """ Base class for helper commands that use the depsolver (i.e., + only resolve dependencies, don't modify the cache) """ + def __init__(self): HelperSubcommand.__init__(self) self.depsolver = DepSolver(Bcfg2.Options.setup.yum_config, @@ -311,6 +317,8 @@ class DepSolverSubcommand(HelperSubcommand): class CacheManagerSubcommand(HelperSubcommand): + """ Base class for helper commands that use the cachemanager + (i.e., modify the cache) """ fallback = False accept_input = False @@ -321,18 +329,22 @@ class CacheManagerSubcommand(HelperSubcommand): class Clean(CacheManagerSubcommand): + """ Clean the cache """ def _run(self, setup, data): # pylint: disable=W0613 self.cachemgr.clean_cache() return True class MakeCache(CacheManagerSubcommand): + """ Update the on-disk cache """ def _run(self, setup, data): # pylint: disable=W0613 self.cachemgr.populate_cache() return True class Complete(DepSolverSubcommand): + """ Given an initial set of packages, get a complete set of + packages with all dependencies resolved """ fallback = dict(packages=[], unknown=[]) def _run(self, _, data): @@ -344,6 +356,7 @@ class Complete(DepSolverSubcommand): class GetGroups(DepSolverSubcommand): + """ Resolve the given package groups """ def _run(self, _, data): rv = dict() for gdata in data: @@ -356,10 +369,11 @@ class GetGroups(DepSolverSubcommand): return rv -Get_Groups = GetGroups +Get_Groups = GetGroups # pylint: disable=C0103 class CLI(Bcfg2.Options.CommandRegistry): + """ The bcfg2-yum-helper CLI """ options = [ Bcfg2.Options.PathOption( "-c", "--yum-config", help="Yum config file"), @@ -377,6 +391,7 @@ class CLI(Bcfg2.Options.CommandRegistry): self.logger = logging.getLogger(parser.prog) def run(self): + """ Run bcfg2-yum-helper """ if not os.path.exists(Bcfg2.Options.setup.yum_config): self.logger.error("Config file %s not found" % Bcfg2.Options.setup.yum_config) diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py index e6240f39a..efd0bbe4a 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py @@ -124,7 +124,8 @@ class Packages(Bcfg2.Server.Plugin.Plugin, Bcfg2.Options.PathOption( cf=("packages", "apt_config"), help="The default path for generated apt configs", - default="/etc/apt/sources.list.d/bcfg2-packages-generated-sources.list")] + default= + "/etc/apt/sources.list.d/bcfg2-packages-generated-sources.list")] #: Packages is an alternative to #: :mod:`Bcfg2.Server.Plugins.Pkgmgr` and conflicts with it. -- cgit v1.2.3-1-g7c22