summaryrefslogtreecommitdiffstats
path: root/src/lib/Client
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2008-09-27 02:20:53 +0000
committerSol Jerome <solj@ices.utexas.edu>2008-09-27 02:20:53 +0000
commit6e8b40a2496bd5c0f531804a210cf6b5ba072ed1 (patch)
tree56804032259587b28d12e5c7386e56562127b540 /src/lib/Client
parent31a81c82a5c8e71a7e355dc1426da10ec6e28a45 (diff)
downloadbcfg2-6e8b40a2496bd5c0f531804a210cf6b5ba072ed1.tar.gz
bcfg2-6e8b40a2496bd5c0f531804a210cf6b5ba072ed1.tar.bz2
bcfg2-6e8b40a2496bd5c0f531804a210cf6b5ba072ed1.zip
Pylint formatting fixes for client tool drivers
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4923 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client')
-rw-r--r--src/lib/Client/Tools/APT.py13
-rw-r--r--src/lib/Client/Tools/FreeBSDInit.py6
-rw-r--r--src/lib/Client/Tools/POSIX.py2
-rw-r--r--src/lib/Client/Tools/Portage.py8
-rw-r--r--src/lib/Client/Tools/RPMng.py2
-rw-r--r--src/lib/Client/Tools/RcUpdate.py36
-rw-r--r--src/lib/Client/Tools/SMF.py12
-rw-r--r--src/lib/Client/Tools/__init__.py4
-rw-r--r--src/lib/Client/Tools/launchd.py5
-rwxr-xr-xsrc/lib/Client/Tools/rpmtools.py22
10 files changed, 69 insertions, 41 deletions
diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py
index 6106b4085..275c0f3a1 100644
--- a/src/lib/Client/Tools/APT.py
+++ b/src/lib/Client/Tools/APT.py
@@ -18,8 +18,14 @@ class APT(Bcfg2.Client.Tools.PkgTool):
__handles__ = [('Package', 'deb')]
__req__ = {'Package': ['name', 'version']}
pkgtype = 'deb'
- pkgtool = ('apt-get -o DPkg::Options::=--force-overwrite -o DPkg::Options::=--force-confold --reinstall -q=2 --force-yes -y install %s',
- ('%s=%s', ['name', 'version']))
+ pkgtool = ('apt-get '
+ '-o DPkg::Options::=--force-overwrite '
+ '-o DPkg::Options::=--force-confold '
+ '--reinstall '
+ '-q=2 '
+ '--force-yes '
+ '-y install %s',
+ ('%s=%s', ['name', 'version']))
svcre = re.compile("/etc/.*/[SK]\d\d(?P<name>\S+)")
@@ -79,7 +85,8 @@ class APT(Bcfg2.Client.Tools.PkgTool):
entry.get('name'))
self.logger.info(bad)
entry.set('qtext',
- "Reinstall Package %s-%s to fix failing md5sums? (y/N) " % (entry.get('name'), entry.get('version')))
+ "Reinstall Package %s-%s to fix failing md5sums? (y/N) " % \
+ (entry.get('name'), entry.get('version')))
return False
return True
else:
diff --git a/src/lib/Client/Tools/FreeBSDInit.py b/src/lib/Client/Tools/FreeBSDInit.py
index 8e13e7981..695698f4c 100644
--- a/src/lib/Client/Tools/FreeBSDInit.py
+++ b/src/lib/Client/Tools/FreeBSDInit.py
@@ -23,12 +23,14 @@ class FreeBSDInit(Bcfg2.Client.Tools.SvcTool):
if self.handlesEntry(entry):
command = "/usr/local/etc/rc.d/%s" % entry.get('name')
if entry.get('status') == 'on' and not self.setup['build']:
- self.logger.debug('Restarting service %s' % entry.get('name'))
+ self.logger.debug('Restarting service %s' % \
+ entry.get('name'))
rc = self.cmd.run('%s %s' % (command, \
entry.get('reload', self.__svcrestart__)))[0]
else:
self.logger.debug('Stopping service %s' % entry.get('name'))
rc = self.cmd.run('%s stop' % command)[0]
if rc:
- self.logger.error("Failed to restart service %s" % (entry.get('name')))
+ self.logger.error("Failed to restart service %s" % \
+ (entry.get('name')))
diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py
index ae90e3575..b2fe3f24b 100644
--- a/src/lib/Client/Tools/POSIX.py
+++ b/src/lib/Client/Tools/POSIX.py
@@ -327,7 +327,7 @@ class POSIX(Bcfg2.Client.Tools.Tool):
except IOError, error:
self.logger.error("Failed to read %s: %s" % (error.filename, error.strerror))
return False
- # comparaison should be done with figerprints or md5sum so it would be faster
+ # comparison should be done with fingerprints or md5sum so it would be faster
# for big binary files
contentStatus = content == tempdata
if not contentStatus:
diff --git a/src/lib/Client/Tools/Portage.py b/src/lib/Client/Tools/Portage.py
index 7d9ecc3ca..02c88186b 100644
--- a/src/lib/Client/Tools/Portage.py
+++ b/src/lib/Client/Tools/Portage.py
@@ -42,12 +42,12 @@ class Portage(Bcfg2.Client.Tools.PkgTool):
if self.installed.has_key(entry.attrib['name']):
if self.installed[entry.attrib['name']] == entry.attrib['version']:
if not self.setup['quick'] and \
- entry.get('verify', 'true') == 'true':
+ entry.get('verify', 'true') == 'true':
output = self.cmd.run \
- ("/usr/bin/equery check =%s 2>&1 |grep '!!!' \
- | awk '{print $2}'" % entry.get('name'))[1]
+ ("/usr/bin/equery check =%s 2>&1 |grep '!!!' \
+ | awk '{print $2}'" % entry.get('name'))[1]
if [filename for filename in output \
- if filename not in modlist]:
+ if filename not in modlist]:
return False
return True
else:
diff --git a/src/lib/Client/Tools/RPMng.py b/src/lib/Client/Tools/RPMng.py
index c1eec1ab6..858a71eef 100644
--- a/src/lib/Client/Tools/RPMng.py
+++ b/src/lib/Client/Tools/RPMng.py
@@ -910,7 +910,7 @@ class RPMng(Bcfg2.Client.Tools.PkgTool):
else:
return '%s:%s-%s.%s' % (instance.get('epoch', '*'),
instance.get('version', '*'),
- instance.get('release', '*'),
+ instance.get('release', '*'),
instance.get('arch', '*'))
def pkg_vr_equal(self, config_entry, installed_entry):
diff --git a/src/lib/Client/Tools/RcUpdate.py b/src/lib/Client/Tools/RcUpdate.py
index d4fd75168..717099954 100644
--- a/src/lib/Client/Tools/RcUpdate.py
+++ b/src/lib/Client/Tools/RcUpdate.py
@@ -11,22 +11,29 @@ class RcUpdate(Bcfg2.Client.Tools.SvcTool):
__req__ = {'Service': ['name', 'status']}
def VerifyService(self, entry, _):
- '''Verify Service status for entry. Assumes we run in the "default" runlevel.'''
- # mrj - i think this should be:
- # rc = self.cmd.run('/bin/rc-status | grep %s | grep started"' % entry.attrib['name'])
- # ...but as i can't figure out a way to test that right now, i'll do the one
- # that works in python's interactive interpreter.
+ '''
+ Verify Service status for entry.
+ Assumes we run in the "default" runlevel.
+ '''
+ # mrj - i think this should be:
+ # rc = self.cmd.run('/bin/rc-status | \
+ # grep %s | \
+ # grep started"' % entry.attrib['name'])
+ #
+ # ...but as i can't figure out a way to
+ # test that right now, i'll do the one
+ # that works in python's interactive interpreter.
rc = commands.getoutput('/bin/rc-status | grep %s | grep started' % \
entry.get('name'))
status = len(rc) > 0
-
+
if not status:
- # service is off
+ # service is off
if entry.get('status') == 'on':
- # we want it on, it's not
+ # we want it on, it's not
entry.set('current_status', 'off')
else:
- # we want it off, it's not
+ # we want it off, it's not
entry.set('current_status', 'on')
return status
@@ -36,14 +43,17 @@ class RcUpdate(Bcfg2.Client.Tools.SvcTool):
try:
os.stat('/etc/init.d/%s' % entry.get('name'))
except OSError:
- self.logger.debug("Init script for service %s does not exist" % entry.get('name'))
+ self.logger.debug("Init script for service %s does not exist" %
+ entry.get('name'))
return False
-
+
if entry.get('status') == 'off':
self.cmd.run("/etc/init.d/%s stop" % (entry.get('name')))
- cmdrc = self.cmd.run("/sbin/rc-update del %s default" % (entry.get('name')))
+ cmdrc = self.cmd.run("/sbin/rc-update del %s default" %
+ (entry.get('name')))
else:
- cmdrc = self.cmd.run("/sbin/rc-update add %s default" % entry.get('name'))[0]
+ cmdrc = self.cmd.run("/sbin/rc-update add %s default" %
+ entry.get('name'))[0]
return cmdrc == 0
def FindExtra(self):
diff --git a/src/lib/Client/Tools/SMF.py b/src/lib/Client/Tools/SMF.py
index 455e5af60..46d12757c 100644
--- a/src/lib/Client/Tools/SMF.py
+++ b/src/lib/Client/Tools/SMF.py
@@ -21,14 +21,16 @@ class SMF(Bcfg2.Client.Tools.Tool):
entry.set('FMRI', name[0])
return True
else:
- self.logger.info('Failed to locate FMRI for service %s' % entry.get('name'))
+ self.logger.info('Failed to locate FMRI for service %s' % \
+ entry.get('name'))
return False
return True
def VerifyService(self, entry, _):
'''Verify SMF Service Entry'''
if not self.GetFMRI(entry):
- self.logger.error("smf service %s doesn't have FMRI set" % entry.get('name'))
+ self.logger.error("smf service %s doesn't have FMRI set" % \
+ entry.get('name'))
return False
if entry.get('FMRI').startswith('lrc'):
filename = entry.get('FMRI').split('/')[-1]
@@ -43,7 +45,8 @@ class SMF(Bcfg2.Client.Tools.Tool):
self.logger.debug("No service matching %s" % (entry.get("FMRI")))
return entry.get('status') == 'off'
try:
- srvdata = self.cmd.run("/usr/bin/svcs -H -o STA %s" % entry.get('FMRI'))[1][0].split()
+ srvdata = self.cmd.run("/usr/bin/svcs -H -o STA %s" % \
+ entry.get('FMRI'))[1][0].split()
except IndexError:
# Ocurrs when no lines are returned (service not installed)
return False
@@ -116,7 +119,8 @@ class SMF(Bcfg2.Client.Tools.Tool):
'''Restart smf services'''
for entry in [entry for entry in bundle if self.handlesEntry(entry)]:
if not self.canInstall(entry):
- self.logger.error("Insufficient information to restart service %s" % (entry.get('name')))
+ self.logger.error("Insufficient information to restart service %s" % \
+ (entry.get('name')))
else:
if entry.get("FMRI").startswith('lrc'):
if entry.get('status') == 'on':
diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py
index bc0c8ec5c..dfe7abf38 100644
--- a/src/lib/Client/Tools/__init__.py
+++ b/src/lib/Client/Tools/__init__.py
@@ -63,7 +63,9 @@ class executor:
return (cmdstat, output)
class Tool:
- '''All tools subclass this. It defines all interfaces that need to be defined'''
+ '''
+ All tools subclass this. It defines all interfaces that need to be defined
+ '''
__name__ = 'Tool'
__execs__ = []
__handles__ = []
diff --git a/src/lib/Client/Tools/launchd.py b/src/lib/Client/Tools/launchd.py
index 84ed4177e..2b9314e54 100644
--- a/src/lib/Client/Tools/launchd.py
+++ b/src/lib/Client/Tools/launchd.py
@@ -11,7 +11,10 @@ class launchd(Bcfg2.Client.Tools.Tool):
__name__ = 'launchd'
__req__ = {'Service':['name', 'status']}
- #currently requires the path to the plist to load/unload, and Name is acually a reverse-fqdn (or the label)
+ '''
+ 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.
diff --git a/src/lib/Client/Tools/rpmtools.py b/src/lib/Client/Tools/rpmtools.py
index 5df6d89a7..d751270e6 100755
--- a/src/lib/Client/Tools/rpmtools.py
+++ b/src/lib/Client/Tools/rpmtools.py
@@ -163,10 +163,10 @@ def rpmpackagelist(rts):
return [ { 'name':header[rpm.RPMTAG_NAME],
'epoch':header[rpm.RPMTAG_EPOCH],
'version':header[rpm.RPMTAG_VERSION],
- 'release':header[rpm.RPMTAG_RELEASE],
+ 'release':header[rpm.RPMTAG_RELEASE],
'arch':header[rpm.RPMTAG_ARCH],
'gpgkeyid':header.sprintf("%|SIGGPG?{%{SIGGPG:pgpsig}}:{None}|").split()[-1] }
- for header in rts.dbMatch()]
+ for header in rts.dbMatch()]
def getindexbykeyword(index_ts, **kwargs):
"""
@@ -262,13 +262,13 @@ def prelink_md5_check(filename):
if isprelink(plfd):
plf.close()
cmd = '/usr/sbin/prelink -y %s 2> /dev/null' \
- % (re.escape(filename))
+ % (re.escape(filename))
plf = os.popen(cmd, 'rb')
prelink = True
elif whitelist_re.search(filename) and not blacklist_re.search(filename):
plf.close()
cmd = '/usr/sbin/prelink -y %s 2> /dev/null' \
- % (re.escape(filename))
+ % (re.escape(filename))
plf = os.popen(cmd, 'rb')
prelink = True
@@ -309,7 +309,7 @@ def prelink_size_check(filename):
if isprelink(plfd):
plf.close()
cmd = '/usr/sbin/prelink -y %s 2> /dev/null' \
- % (re.escape(filename))
+ % (re.escape(filename))
plf = os.popen(cmd, 'rb')
while 1:
@@ -322,7 +322,7 @@ def prelink_size_check(filename):
# print "***** Warning isprelink extension failed to import ******"
plf.close()
cmd = '/usr/sbin/prelink -y %s 2> /dev/null' \
- % (re.escape(filename))
+ % (re.escape(filename))
plf = os.popen(cmd, 'rb')
while 1:
@@ -609,12 +609,12 @@ def rpm_verify_package(vp_ts, header, verify_options):
vp_fi = header.fiFromHeader()
for fileinfo in vp_fi:
# Do not bother doing anything with ghost files.
- # This is what RPM does.
+ # This is what RPM does.
if fileinfo[4] & rpm.RPMFILE_GHOST:
continue
# This is only needed because of an inconsistency in the
- # rpm.fi interface.
+ # rpm.fi interface.
linktos = vp_fi.FLink()
file_stat = rpm_verify_file(fileinfo, linktos, omitmask)
@@ -736,7 +736,7 @@ class Rpmtscallback(object):
def callback(self, reason, amount, total, key, client_data):
"""
- Generic rpmts call back.
+ Generic rpmts call back.
"""
if reason == rpm.RPMCALLBACK_INST_OPEN_FILE:
pass
@@ -748,10 +748,10 @@ class Rpmtscallback(object):
pass
#print 'rpm.RPMCALLBACK_INST_START'
elif reason == rpm.RPMCALLBACK_TRANS_PROGRESS or \
- reason == rpm.RPMCALLBACK_INST_PROGRESS:
+ reason == rpm.RPMCALLBACK_INST_PROGRESS:
pass
#print 'rpm.RPMCALLBACK_TRANS_PROGRESS or \
- # rpm.RPMCALLBACK_INST_PROGRESS'
+ # rpm.RPMCALLBACK_INST_PROGRESS'
elif reason == rpm.RPMCALLBACK_TRANS_START:
pass
#print 'rpm.RPMCALLBACK_TRANS_START'