summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Bcfg2/Client/Frame.py15
-rw-r--r--src/lib/Bcfg2/Client/Tools/DebInit.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/Encap.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/FreeBSDPackage.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/Portage.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/SELinux.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/Upstart.py2
-rw-r--r--src/lib/Bcfg2/Client/__init__.py6
-rw-r--r--src/lib/Bcfg2/Logger.py12
-rw-r--r--src/lib/Bcfg2/Options.py6
-rw-r--r--src/lib/Bcfg2/Server/Admin/__init__.py21
-rw-r--r--src/lib/Bcfg2/Server/Lint/RequiredAttrs.py6
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py26
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Bundler.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py10
-rw-r--r--src/lib/Bcfg2/Server/Plugins/GroupPatterns.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Metadata.py1
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Apt.py6
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Source.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Probes.py8
-rw-r--r--src/lib/Bcfg2/Server/Plugins/__init__.py31
-rw-r--r--src/lib/Bcfg2/Server/__init__.py5
-rw-r--r--src/lib/Bcfg2/__init__.py3
-rw-r--r--testsuite/pylintrc.conf5
26 files changed, 74 insertions, 111 deletions
diff --git a/src/lib/Bcfg2/Client/Frame.py b/src/lib/Bcfg2/Client/Frame.py
index ad5447736..fe4943fdf 100644
--- a/src/lib/Bcfg2/Client/Frame.py
+++ b/src/lib/Bcfg2/Client/Frame.py
@@ -310,10 +310,10 @@ class Frame(object):
for bundle in self.setup['bundle']:
if bundle not in all_bundle_names:
self.logger.info("Warning: Bundle %s not found" % bundle)
- bundles = filter(lambda b: b.get('name') in self.setup['bundle'],
- bundles)
+ bundles = [b for b in bundles
+ if b.get('name') in self.setup['bundle']]
elif self.setup['indep']:
- bundles = filter(lambda b: b.tag != 'Bundle', bundles)
+ bundles = [b for b in bundles if b.tag != 'Bundle']
if self.setup['skipbundle']:
# warn if non-existent bundle given
if not self.setup['bundle_quick']:
@@ -321,14 +321,13 @@ class Frame(object):
if bundle not in all_bundle_names:
self.logger.info("Warning: Bundle %s not found" %
bundle)
- bundles = filter(lambda b: \
- b.get('name') not in self.setup['skipbundle'],
- bundles)
+ bundles = [b for b in bundles
+ if b.get('name') not in self.setup['skipbundle']]
if self.setup['skipindep']:
- bundles = filter(lambda b: b.tag == 'Bundle', bundles)
+ bundles = [b for b in bundles if b.tag == 'Bundle']
self.whitelist = [e for e in self.whitelist
- if True in [e in b for b in bundles]]
+ if any(e in b for b in bundles)]
# first process prereq actions
for bundle in bundles[:]:
diff --git a/src/lib/Bcfg2/Client/Tools/DebInit.py b/src/lib/Bcfg2/Client/Tools/DebInit.py
index ca556e98b..d916b1662 100644
--- a/src/lib/Bcfg2/Client/Tools/DebInit.py
+++ b/src/lib/Bcfg2/Client/Tools/DebInit.py
@@ -16,7 +16,7 @@ class DebInit(Bcfg2.Client.Tools.SvcTool):
__handles__ = [('Service', 'deb')]
__req__ = {'Service': ['name', 'status']}
svcre = \
- re.compile("/etc/.*/(?P<action>[SK])(?P<sequence>\d+)(?P<name>\S+)")
+ re.compile(r'/etc/.*/(?P<action>[SK])(?P<sequence>\d+)(?P<name>\S+)')
# implement entry (Verify|Install) ops
def VerifyService(self, entry, _):
diff --git a/src/lib/Bcfg2/Client/Tools/Encap.py b/src/lib/Bcfg2/Client/Tools/Encap.py
index 678e0f00c..270f0a5f2 100644
--- a/src/lib/Bcfg2/Client/Tools/Encap.py
+++ b/src/lib/Bcfg2/Client/Tools/Encap.py
@@ -13,7 +13,7 @@ class Encap(Bcfg2.Client.Tools.PkgTool):
__req__ = {'Package': ['version', 'url']}
pkgtype = 'encap'
pkgtool = ("/usr/local/bin/epkg -l -f -q %s", ("%s", ["url"]))
- splitter = re.compile('.*/(?P<name>[\w-]+)\-(?P<version>[\w\.+-]+)')
+ splitter = re.compile(r'.*/(?P<name>[\w-]+)\-(?P<version>[\w\.+-]+)')
def RefreshPackages(self):
"""Try to find encap packages."""
diff --git a/src/lib/Bcfg2/Client/Tools/FreeBSDPackage.py b/src/lib/Bcfg2/Client/Tools/FreeBSDPackage.py
index 395f56f6a..31925fa3c 100644
--- a/src/lib/Bcfg2/Client/Tools/FreeBSDPackage.py
+++ b/src/lib/Bcfg2/Client/Tools/FreeBSDPackage.py
@@ -21,7 +21,7 @@ class FreeBSDPackage(Bcfg2.Client.Tools.PkgTool):
def RefreshPackages(self):
self.installed = {}
packages = self.cmd.run("/usr/sbin/pkg_info -a -E").stdout.splitlines()
- pattern = re.compile('(.*)-(\d.*)')
+ pattern = re.compile(r'(.*)-(\d.*)')
for pkg in packages:
if pattern.match(pkg):
name = pattern.match(pkg).group(1)
diff --git a/src/lib/Bcfg2/Client/Tools/Portage.py b/src/lib/Bcfg2/Client/Tools/Portage.py
index 69d52b052..17e7755a9 100644
--- a/src/lib/Bcfg2/Client/Tools/Portage.py
+++ b/src/lib/Bcfg2/Client/Tools/Portage.py
@@ -22,7 +22,7 @@ class Portage(Bcfg2.Client.Tools.PkgTool):
Bcfg2.Client.Tools.PkgTool.__init__(self, logger, cfg, setup)
self._initialised = True
self.__important__ = self.__important__ + ['/etc/make.conf']
- self._pkg_pattern = re.compile('(.*)-(\d.*)')
+ self._pkg_pattern = re.compile(r'(.*)-(\d.*)')
self._ebuild_pattern = re.compile('(ebuild|binary)')
self.cfg = cfg
self.installed = {}
diff --git a/src/lib/Bcfg2/Client/Tools/SELinux.py b/src/lib/Bcfg2/Client/Tools/SELinux.py
index f277cb0c8..617b7c2ef 100644
--- a/src/lib/Bcfg2/Client/Tools/SELinux.py
+++ b/src/lib/Bcfg2/Client/Tools/SELinux.py
@@ -170,7 +170,7 @@ class SELinuxEntryHandler(object):
key_format = ("name",)
value_format = ()
str_format = '%(name)s'
- custom_re = re.compile(' (?P<name>\S+)$')
+ custom_re = re.compile(r' (?P<name>\S+)$')
custom_format = None
def __init__(self, tool, logger, setup, config):
diff --git a/src/lib/Bcfg2/Client/Tools/Upstart.py b/src/lib/Bcfg2/Client/Tools/Upstart.py
index 921ca849f..c96eab69d 100644
--- a/src/lib/Bcfg2/Client/Tools/Upstart.py
+++ b/src/lib/Bcfg2/Client/Tools/Upstart.py
@@ -46,7 +46,7 @@ class Upstart(Bcfg2.Client.Tools.SvcTool):
entry.get('name'))
return False
- match = re.compile("%s( \(.*\))? (start|stop)/(running|waiting)" %
+ match = re.compile(r'%s( \(.*\))? (start|stop)/(running|waiting)' %
entry.get('name')).match(output)
if match is None:
# service does not exist
diff --git a/src/lib/Bcfg2/Client/__init__.py b/src/lib/Bcfg2/Client/__init__.py
index dd5ae1e83..8c8c4fd94 100644
--- a/src/lib/Bcfg2/Client/__init__.py
+++ b/src/lib/Bcfg2/Client/__init__.py
@@ -1,11 +1,11 @@
"""This contains all Bcfg2 Client modules"""
-__all__ = ["Frame", "Tools", "XML", "Client"]
-
import os
import sys
import select
-from Bcfg2.Compat import input # pylint: disable=W0622
+from Bcfg2.Compat import input, walk_packages # pylint: disable=W0622
+
+__all__ = [m[1] for m in walk_packages(path=__path__)]
def prompt(msg):
diff --git a/src/lib/Bcfg2/Logger.py b/src/lib/Bcfg2/Logger.py
index 1f7348207..e537b6148 100644
--- a/src/lib/Bcfg2/Logger.py
+++ b/src/lib/Bcfg2/Logger.py
@@ -144,9 +144,9 @@ def add_console_handler(level=logging.DEBUG):
# tell the handler to use this format
console.setFormatter(TermiosFormatter())
try:
- console.set_name("console")
+ console.set_name("console") # pylint: disable=E1101
except AttributeError:
- console.name = "console"
+ console.name = "console" # pylint: disable=W0201
logging.root.addHandler(console)
@@ -162,9 +162,9 @@ def add_syslog_handler(procname, syslog_facility, level=logging.DEBUG):
('localhost', 514),
syslog_facility)
try:
- syslog.set_name("syslog")
+ syslog.set_name("syslog") # pylint: disable=E1101
except AttributeError:
- syslog.name = "syslog"
+ syslog.name = "syslog" # pylint: disable=W0201
syslog.setLevel(level)
syslog.setFormatter(
logging.Formatter('%(name)s[%(process)d]: %(message)s'))
@@ -179,9 +179,9 @@ def add_file_handler(to_file, level=logging.DEBUG):
"""Add a logging handler that logs to to_file."""
filelog = logging.FileHandler(to_file)
try:
- filelog.set_name("file")
+ filelog.set_name("file") # pylint: disable=E1101
except AttributeError:
- filelog.name = "file"
+ filelog.name = "file" # pylint: disable=W0201
filelog.setLevel(level)
filelog.setFormatter(
logging.Formatter('%(asctime)s %(name)s[%(process)d]: %(message)s'))
diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py
index 7c91ca3cc..66e987b91 100644
--- a/src/lib/Bcfg2/Options.py
+++ b/src/lib/Bcfg2/Options.py
@@ -308,14 +308,14 @@ def list_split(c_string):
""" split an option string on commas, optionally surrounded by
whitespace, returning a list """
if c_string:
- return re.split("\s*,\s*", c_string)
+ return re.split(r'\s*,\s*', c_string)
return []
def colon_split(c_string):
""" split an option string on colons, returning a list """
if c_string:
- return c_string.split(':')
+ return c_string.split(r':')
return []
@@ -355,7 +355,7 @@ def get_size(value):
'512m', '2g'), get the absolute number of bytes as an integer """
if value == -1:
return value
- mat = re.match("(\d+)([KkMmGg])?", value)
+ mat = re.match(r'(\d+)([KkMmGg])?', value)
if not mat:
raise ValueError("Not a valid size", value)
rvalue = int(mat.group(1))
diff --git a/src/lib/Bcfg2/Server/Admin/__init__.py b/src/lib/Bcfg2/Server/Admin/__init__.py
index a3c45b8c3..7bba05eb3 100644
--- a/src/lib/Bcfg2/Server/Admin/__init__.py
+++ b/src/lib/Bcfg2/Server/Admin/__init__.py
@@ -1,29 +1,14 @@
""" Base classes for admin modes """
-__all__ = ['Backup',
- 'Bundle',
- 'Client',
- 'Compare',
- 'Group',
- 'Init',
- 'Minestruct',
- 'Perf',
- 'Pull',
- 'Query',
- 'Reports',
- 'Snapshots',
- 'Syncdb',
- 'Tidy',
- 'Viz',
- 'Xcmd']
-
import re
import sys
import logging
import lxml.etree
import Bcfg2.Server.Core
import Bcfg2.Options
-from Bcfg2.Compat import ConfigParser
+from Bcfg2.Compat import ConfigParser, walk_packages
+
+__all__ = [m[1] for m in walk_packages(path=__path__)]
class Mode(object):
diff --git a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py
index be4264b07..c709d639c 100644
--- a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py
+++ b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py
@@ -87,12 +87,12 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin):
command=None)},
ACL=dict(
default=dict(scope=lambda v: v in ['user', 'group'],
- perms=lambda v: re.match('^([0-7]|[rwx\-]{0,3}',
+ perms=lambda v: re.match(r'^([0-7]|[rwx\-]{0,3}',
v)),
access=dict(scope=lambda v: v in ['user', 'group'],
- perms=lambda v: re.match('^([0-7]|[rwx\-]{0,3}',
+ perms=lambda v: re.match(r'^([0-7]|[rwx\-]{0,3}',
v)),
- mask=dict(perms=lambda v: re.match('^([0-7]|[rwx\-]{0,3}',
+ mask=dict(perms=lambda v: re.match(r'^([0-7]|[rwx\-]{0,3}',
v))),
Package={"__any__": dict(name=None)},
SEBoolean={None: dict(name=None,
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index bddd0ba20..a7cdea879 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -41,15 +41,15 @@ del DEFAULT_FILE_METADATA['configfile']
LOGGER = logging.getLogger(__name__)
#: a compiled regular expression for parsing info and :info files
-INFO_REGEX = re.compile('owner:(\s)*(?P<owner>\S+)|' +
- 'group:(\s)*(?P<group>\S+)|' +
- 'mode:(\s)*(?P<mode>\w+)|' +
- 'secontext:(\s)*(?P<secontext>\S+)|' +
- 'paranoid:(\s)*(?P<paranoid>\S+)|' +
- 'sensitive:(\s)*(?P<sensitive>\S+)|' +
- 'encoding:(\s)*(?P<encoding>\S+)|' +
- 'important:(\s)*(?P<important>\S+)|' +
- 'mtime:(\s)*(?P<mtime>\w+)|')
+INFO_REGEX = re.compile(r'owner:(\s)*(?P<owner>\S+)|' +
+ r'group:(\s)*(?P<group>\S+)|' +
+ r'mode:(\s)*(?P<mode>\w+)|' +
+ r'secontext:(\s)*(?P<secontext>\S+)|' +
+ r'paranoid:(\s)*(?P<paranoid>\S+)|' +
+ r'sensitive:(\s)*(?P<sensitive>\S+)|' +
+ r'encoding:(\s)*(?P<encoding>\S+)|' +
+ r'important:(\s)*(?P<important>\S+)|' +
+ r'mtime:(\s)*(?P<mtime>\w+)|')
def bind_info(entry, metadata, infoxml=None, default=DEFAULT_FILE_METADATA):
@@ -873,7 +873,7 @@ class XMLDirectoryBacked(DirectoryBacked):
#: Only track and include files whose names (not paths) match this
#: compiled regex.
- patterns = re.compile('^.*\.xml$')
+ patterns = re.compile(r'^.*\.xml$')
#: The type of child objects to create for files contained within
#: the directory that is tracked. Default is
@@ -1142,7 +1142,7 @@ class EntrySet(Debuggable):
#: file is encountered that does not match the ``basename``
#: argument passed to the constructor or ``ignore``, then a
#: warning will be produced.
- ignore = re.compile("^(\.#.*|.*~|\\..*\\.(sw[px])|.*\\.genshi_include)$")
+ ignore = re.compile(r'^(\.#.*|.*~|\\..*\\.(sw[px])|.*\\.genshi_include)$')
# The ``basename`` argument passed to the constructor will be
#: processed as a string that contains a regular expression (i.e.,
@@ -1205,8 +1205,8 @@ class EntrySet(Debuggable):
base_pat = basename
else:
base_pat = re.escape(basename)
- pattern = '(.*/)?%s(\.((H_(?P<hostname>\S+))|' % base_pat
- pattern += '(G(?P<prio>\d+)_(?P<group>\S+))))?$'
+ pattern = r'(.*/)?%s(\.((H_(?P<hostname>\S+))|' % base_pat
+ pattern += r'(G(?P<prio>\d+)_(?P<group>\S+))))?$'
#: ``specific`` is a regular expression that is used to
#: determine the specificity of a file in this entry set. It
diff --git a/src/lib/Bcfg2/Server/Plugins/Bundler.py b/src/lib/Bcfg2/Server/Plugins/Bundler.py
index a9b9bf8c1..5c5e3da0c 100644
--- a/src/lib/Bcfg2/Server/Plugins/Bundler.py
+++ b/src/lib/Bcfg2/Server/Plugins/Bundler.py
@@ -83,7 +83,7 @@ class Bundler(Bcfg2.Server.Plugin.Plugin,
""" The bundler creates dependent clauses based on the
bundle/translation scheme from Bcfg1. """
__author__ = 'bcfg-dev@mcs.anl.gov'
- patterns = re.compile('^(?P<name>.*)\.(xml|genshi)$')
+ patterns = re.compile(r'^(?P<name>.*)\.(xml|genshi)$')
def __init__(self, core, datastore):
Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore)
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py
index c2e5afbad..83a5c1165 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py
@@ -90,7 +90,7 @@ class CfgGenshiGenerator(CfgGenerator):
#: exception in a Genshi template so we can provide a decent error
#: message that actually tells the end user where an error
#: occurred.
- pyerror_re = re.compile('<\w+ u?[\'"](.*?)\s*\.\.\.[\'"]>')
+ pyerror_re = re.compile(r'<\w+ u?[\'"](.*?)\s*\.\.\.[\'"]>')
def __init__(self, fname, spec, encoding):
CfgGenerator.__init__(self, fname, spec, encoding)
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
index f347b898c..ffc26713f 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
@@ -111,12 +111,12 @@ class CfgBaseFileMatcher(Bcfg2.Server.Plugin.SpecificData,
components = ['^(?P<basename>%s)' % '|'.join(re.escape(b)
for b in basenames)]
if cls.__specific__:
- components.append('(|\\.H_(?P<hostname>\S+?)|' +
- '\.G(?P<prio>\d+)_(?P<group>\S+?))')
+ components.append(r'(|\\.H_(?P<hostname>\S+?)|' +
+ r'\.G(?P<prio>\d+)_(?P<group>\S+?))')
if cls.__extensions__:
- components.append('\\.(?P<extension>%s)' %
- '|'.join(cls.__extensions__))
- components.append('$')
+ components.append(r'\\.(?P<extension>%s)' %
+ r'|'.join(cls.__extensions__))
+ components.append(r'$')
return re.compile("".join(components))
@classmethod
diff --git a/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py b/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py
index fcfae2088..8d1e50526 100644
--- a/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py
+++ b/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py
@@ -23,8 +23,8 @@ class PatternMap(object):
raise Exception("Backslashes are not allowed in NameRanges")
range_finder = r'\[\[[\d\-,]+\]\]'
self.process = self.process_range
- self.re = re.compile('^' + re.sub(range_finder, '(\d+)',
- rangestr))
+ self.re = re.compile(r'^' + re.sub(range_finder, r'(\d+)',
+ rangestr))
dmatcher = re.compile(re.sub(range_finder,
r'\[\[([\d\-,]+)\]\]',
rangestr))
diff --git a/src/lib/Bcfg2/Server/Plugins/Metadata.py b/src/lib/Bcfg2/Server/Plugins/Metadata.py
index 10b09842a..3611f2c6e 100644
--- a/src/lib/Bcfg2/Server/Plugins/Metadata.py
+++ b/src/lib/Bcfg2/Server/Plugins/Metadata.py
@@ -1603,6 +1603,7 @@ class MetadataLint(Bcfg2.Server.Lint.ServerPlugin):
(etype.title(), ename, "\n".join(els)))
def default_is_profile(self):
+ """ ensure that the default group is a profile group """
if (self.metadata.default and
not self.metadata.groups[self.metadata.default].is_profile):
xdata = \
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py b/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py
index 5ae160994..4eefd0722 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py
@@ -104,8 +104,8 @@ class AptSource(Source):
vindex = 0
for dep in words[1].split(','):
if '|' in dep:
- cdeps = [re.sub('\s+', '',
- re.sub('\(.*\)', '', cdep))
+ cdeps = [re.sub(r'\s+', '',
+ re.sub(r'\(.*\)', '', cdep))
for cdep in dep.split('|')]
dyn_dname = "choice-%s-%s-%s" % (pkgname,
barch,
@@ -114,7 +114,7 @@ class AptSource(Source):
bdeps[barch][pkgname].append(dyn_dname)
bprov[barch][dyn_dname] = set(cdeps)
else:
- raw_dep = re.sub('\(.*\)', '', dep)
+ raw_dep = re.sub(r'\(.*\)', '', dep)
raw_dep = raw_dep.rstrip().strip()
bdeps[barch][pkgname].append(raw_dep)
elif words[0] == 'Provides':
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
index 0c6ee0759..b4d481459 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
@@ -65,7 +65,7 @@ def fetch_url(url):
:raises: URLError - Failure fetching URL
:returns: string - the content of the page at the given URL """
if '@' in url:
- mobj = re.match('(\w+://)([^:]+):([^@]+)@(.*)$', url)
+ mobj = re.match(r'(\w+://)([^:]+):([^@]+)@(.*)$', url)
if not mobj:
raise ValueError("Invalid URL")
user = mobj.group(2)
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index 77186d2cb..7438c633b 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -422,7 +422,7 @@ class YumCollection(Collection):
config.add_section(reponame)
added = True
except ConfigParser.DuplicateSectionError:
- match = re.search("-(\d+)", reponame)
+ match = re.search(r'-(\d+)', reponame)
if match:
rid = int(match.group(1)) + 1
else:
diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py
index 634826f4b..d57eb4228 100644
--- a/src/lib/Bcfg2/Server/Plugins/Probes.py
+++ b/src/lib/Bcfg2/Server/Plugins/Probes.py
@@ -111,15 +111,15 @@ class ProbeData(str):
class ProbeSet(Bcfg2.Server.Plugin.EntrySet):
""" Handle universal and group- and host-specific probe files """
- ignore = re.compile("^(\.#.*|.*~|\\..*\\.(tmp|sw[px])|probed\\.xml)$")
+ ignore = re.compile(r'^(\.#.*|.*~|\\..*\\.(tmp|sw[px])|probed\\.xml)$')
probename = \
- re.compile("(.*/)?(?P<basename>\S+?)(\.(?P<mode>(?:G\d\d)|H)_\S+)?$")
- bangline = re.compile('^#!\s*(?P<interpreter>.*)$')
+ re.compile(r'(.*/)?(?P<basename>\S+?)(\.(?P<mode>(?:G\d\d)|H)_\S+)?$')
+ bangline = re.compile(r'^#!\s*(?P<interpreter>.*)$')
basename_is_regex = True
def __init__(self, path, fam, encoding, plugin_name):
self.plugin_name = plugin_name
- Bcfg2.Server.Plugin.EntrySet.__init__(self, '[0-9A-Za-z_\-]+', path,
+ Bcfg2.Server.Plugin.EntrySet.__init__(self, r'[0-9A-Za-z_\-]+', path,
Bcfg2.Server.Plugin.SpecificData,
encoding)
fam.AddMonitor(path, self)
diff --git a/src/lib/Bcfg2/Server/Plugins/__init__.py b/src/lib/Bcfg2/Server/Plugins/__init__.py
index 063e14315..ad51cf368 100644
--- a/src/lib/Bcfg2/Server/Plugins/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/__init__.py
@@ -1,30 +1,5 @@
"""Imports for Bcfg2.Server.Plugins."""
-__all__ = ['Account',
- 'Base',
- 'Bundler',
- 'Bzr',
- 'Cfg',
- 'Cvs',
- 'Darcs',
- 'Decisions',
- 'Fossil',
- 'Git',
- 'GroupPatterns',
- 'Hg',
- 'Hostbase',
- 'Metadata',
- 'NagiosGen',
- 'Ohai',
- 'Packages',
- 'Properties',
- 'Probes',
- 'Pkgmgr',
- 'Rules',
- 'SSHbase',
- 'Snapshots',
- 'Statistics',
- 'Svn',
- 'TCheetah',
- 'Trigger',
- 'TGenshi']
+from Bcfg2.Compat import walk_packages
+
+__all__ = [m[1] for m in walk_packages(path=__path__)]
diff --git a/src/lib/Bcfg2/Server/__init__.py b/src/lib/Bcfg2/Server/__init__.py
index 3eb300a98..0678e4579 100644
--- a/src/lib/Bcfg2/Server/__init__.py
+++ b/src/lib/Bcfg2/Server/__init__.py
@@ -1,10 +1,9 @@
"""This is the set of modules for Bcfg2.Server."""
import lxml.etree
+from Bcfg2.Compat import walk_packages
-__all__ = ["Admin", "Core", "FileMonitor", "Plugin", "Plugins",
- "Hostbase", "Reports", "Snapshots", "XMLParser",
- "XI", "XI_NAMESPACE"]
+__all__ = [m[1] for m in walk_packages(path=__path__)]
XI = 'http://www.w3.org/2001/XInclude'
XI_NAMESPACE = '{%s}' % XI
diff --git a/src/lib/Bcfg2/__init__.py b/src/lib/Bcfg2/__init__.py
index 3fe2a0d75..41743d100 100644
--- a/src/lib/Bcfg2/__init__.py
+++ b/src/lib/Bcfg2/__init__.py
@@ -1,3 +1,4 @@
"""Base modules definition."""
-__all__ = ['Server', 'Client', 'Logger', 'Options', 'Proxy', 'Statistics']
+from Bcfg2.Compat import walk_packages
+__all__ = [m[1] for m in walk_packages(path=__path__)]
diff --git a/testsuite/pylintrc.conf b/testsuite/pylintrc.conf
index 14ccd1d23..15f8ae23c 100644
--- a/testsuite/pylintrc.conf
+++ b/testsuite/pylintrc.conf
@@ -33,7 +33,7 @@ load-plugins=ext.exception_messages
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).
-disable=F0401,W0142,W0511,W0603,W1201,R0201,R0801,R0901,R0902,R0903,R0904,R0921,R0922,C0302,I0011,E0100,E0101,E0102,E0106
+disable=F0401,W0142,W0511,W0603,W1201,R0201,R0801,R0901,R0902,R0903,R0904,R0921,R0922,R0924,C0302,I0011,E0100,E0101,E0102,E0106
# Some of these are disabled because they warn about things we _want_:
#
# * W0142: Used * or ** magic
@@ -41,9 +41,12 @@ disable=F0401,W0142,W0511,W0603,W1201,R0201,R0801,R0901,R0902,R0903,R0904,R0921,
# * I0011: Locally disabling a pylint message
# * R0921: Abstract class not referenced
# * R0922: Abstract class is only referenced a small number of times
+# * R0924: Badly implemented Container
#
# We have several modules, e.g., Bcfg2.Server.Plugin.interfaces, that
# only declare abstract classes, which makes R0921 and R0922 useless.
+# We also have several container objects that are immutable, which
+# R0924 doesn't like.
# Some of these are disabled because they just aren't that useful:
#