diff options
-rw-r--r-- | src/lib/Client/Frame.py | 2 | ||||
-rw-r--r-- | src/lib/Client/Tools/DebInit.py | 2 | ||||
-rw-r--r-- | src/lib/Client/Tools/Encap.py | 2 | ||||
-rw-r--r-- | src/lib/Client/Tools/Portage.py | 6 | ||||
-rw-r--r-- | src/lib/Client/Tools/launchd.py | 14 | ||||
-rw-r--r-- | src/lib/Client/XML.py | 2 | ||||
-rw-r--r-- | src/lib/Server/Component.py | 5 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Hostbase.py | 5 |
8 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index 762be7a10..6d64b5064 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -9,7 +9,7 @@ def cmpent(ent1, ent2): if ent1.tag != ent2.tag: return cmp(ent1.tag, ent2.tag) else: - return cmd(ent1.get('name'), ent2.get('name')) + return cmp(ent1.get('name'), ent2.get('name')) def promptFilter(prompt, entries): '''Filter a supplied list based on user input''' diff --git a/src/lib/Client/Tools/DebInit.py b/src/lib/Client/Tools/DebInit.py index c1fbffad6..addf3c1a8 100644 --- a/src/lib/Client/Tools/DebInit.py +++ b/src/lib/Client/Tools/DebInit.py @@ -60,7 +60,7 @@ class DebInit(Bcfg2.Client.Tools.SvcTool): return [Bcfg2.Client.XML.Element('Service', name=name, type='deb') for name \ in extra] - def Remove(self, entries): + def Remove(self, _): '''Remove extra service entries''' # Extra service removal is nonsensical # Extra services need to be reflected in the config diff --git a/src/lib/Client/Tools/Encap.py b/src/lib/Client/Tools/Encap.py index 4e9ef6c10..102eb0987 100644 --- a/src/lib/Client/Tools/Encap.py +++ b/src/lib/Client/Tools/Encap.py @@ -26,7 +26,7 @@ class Encap(Bcfg2.Client.Tools.PkgTool): self.installed[match.group('name')] = match.group('version') else: print "Failed to split name %s" % pkg - self.logger.debug("Encap.py: RefreshPackages: self.installed.keys() are:") + self.logger.debug("Encap.py: RefreshPackages: self.installed.keys() are:") self.logger.debug("%s" % self.installed.keys()) def VerifyPackage(self, entry, _): diff --git a/src/lib/Client/Tools/Portage.py b/src/lib/Client/Tools/Portage.py index 0eb6c3476..3116578b0 100644 --- a/src/lib/Client/Tools/Portage.py +++ b/src/lib/Client/Tools/Portage.py @@ -15,7 +15,7 @@ class Portage(Bcfg2.Client.Tools.PkgTool): __handles__ = [('Package', 'ebuild')] __req__ = {'Package': ['name', 'version']} pkgtype = 'ebuild' - '''requires a working PORTAGE_BINHOST in make.conf''' + # requires a working PORTAGE_BINHOST in make.conf pkgtool = ('emerge --getbinpkgonly =%s', ('%s-%s', ['name', 'version'])) def __init__(self, logger, cfg, setup, states): @@ -33,8 +33,8 @@ class Portage(Bcfg2.Client.Tools.PkgTool): for pkg in cache: pattern = re.compile('(.*)-(\d.*)') if pattern.match(pkg): - name = pattern.match(pkg).group(1) - version = pattern.match(pkg).group(2) + name = pattern.match(pkg).group(1) + version = pattern.match(pkg).group(2) self.installed[name] = version def VerifyPackage(self, entry, modlist): diff --git a/src/lib/Client/Tools/launchd.py b/src/lib/Client/Tools/launchd.py index b0b657dfc..177169dac 100644 --- a/src/lib/Client/Tools/launchd.py +++ b/src/lib/Client/Tools/launchd.py @@ -1,7 +1,7 @@ '''launchd support for Bcfg2''' __revision__ = '$Revision: 2596 $' -import glob, os +import os import Bcfg2.Client.Tools class launchd(Bcfg2.Client.Tools.Tool): @@ -13,12 +13,12 @@ class launchd(Bcfg2.Client.Tools.Tool): #currently requires the path to the plist to load/unload, and Name is acually a reverse-fqdn (or the label) def FindPlist(self, entry): - '''Locate plist file that provides given reverse-fqdn name''' - '''/Library/LaunchAgents Per-user agents provided by the administrator. + '''Locate plist file that provides given reverse-fqdn name + /Library/LaunchAgents Per-user agents provided by the administrator. /Library/LaunchDaemons System wide daemons provided by the administrator. /System/Library/LaunchAgents Mac OS X Per-user agents. /System/Library/LaunchDaemons Mac OS X System wide daemons.''' - plistLocations = ["/Library/LaunchDaemons","/System/Library/LaunchDaemons"] + plistLocations = ["/Library/LaunchDaemons", "/System/Library/LaunchDaemons"] plistMapping = {} for directory in plistLocations: for daemon in os.listdir(directory): @@ -27,7 +27,9 @@ class launchd(Bcfg2.Client.Tools.Tool): d = daemon[:(len(daemon)-6)] else: d = daemon - plistMapping[self.cmd.run("defaults read %s/%s Label"%(directory,d))[1][0]] = "%s/%s"%(directory,daemon) + plistMapping[self.cmd.run( \ + "defaults read %s/%s Label" % (directory, d))[1][0]] = \ + "%s/%s"%(directory, daemon) except KeyError: #perhaps this could be more robust pass try: @@ -74,7 +76,7 @@ class launchd(Bcfg2.Client.Tools.Tool): try: allsrv = self.cmd.run("/bin/launchctl list")[1] except IndexError: - allsrv = []; + allsrv = [] [allsrv.remove(svc) for svc in [entry.get("name") for entry in self.getSupportedEntries()] if svc in allsrv] diff --git a/src/lib/Client/XML.py b/src/lib/Client/XML.py index ec668711a..adca4079a 100644 --- a/src/lib/Client/XML.py +++ b/src/lib/Client/XML.py @@ -22,3 +22,5 @@ except ImportError: print "Failed to load lxml, xml.etree and elementtree.ElementTree" print "Cannot continue" raise SystemExit, 1 + +len([Element, SubElement, XML, tostring, ParseError]) diff --git a/src/lib/Server/Component.py b/src/lib/Server/Component.py index ecb476780..1a159282c 100644 --- a/src/lib/Server/Component.py +++ b/src/lib/Server/Component.py @@ -44,6 +44,7 @@ class CobaltXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): self.connection.shutdown() def setup(self): + '''Setup a working connection''' self.connection = self.request self.rfile = socket._fileobject(self.request, "rb", self.rbufsize) self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) @@ -153,10 +154,6 @@ class Component(SSLServer, self.assert_location() atexit.register(self.deassert_location) - def HandleEvents(self, address, event_list): - '''Default event handler''' - return True - def _cobalt_marshalled_dispatch(self, data, address): """Decode and dispatch XMLRPC requests. Overloaded to pass through client address information diff --git a/src/lib/Server/Plugins/Hostbase.py b/src/lib/Server/Plugins/Hostbase.py index f4be21295..7247da30d 100644 --- a/src/lib/Server/Plugins/Hostbase.py +++ b/src/lib/Server/Plugins/Hostbase.py @@ -1,11 +1,10 @@ '''This file provides the Hostbase plugin. It manages dns/dhcp/nis host information''' __revision__ = '$Revision$' -import sys, os +import os os.environ['DJANGO_SETTINGS_MODULE'] = 'Bcfg2.Server.Hostbase.settings' from lxml.etree import Element, SubElement -from syslog import syslog, LOG_INFO -from Bcfg2.Server.Plugin import Plugin, PluginExecutionError, PluginInitError, DirectoryBacked +from Bcfg2.Server.Plugin import Plugin, PluginExecutionError from time import strftime from sets import Set from django.template import Context, loader |