summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Tools/__init__.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-08-26 21:28:14 +0000
committerSol Jerome <sol.jerome@gmail.com>2010-08-27 08:28:39 -0500
commitdecb4dd187c808e2f1c0ff7040e914abc7adeae2 (patch)
treeb1389cc43826a1512b2bf0458d4653a3160bd4a7 /src/lib/Client/Tools/__init__.py
parentd84167e06dd4d607e86a0f5599d95eee331ce907 (diff)
downloadbcfg2-decb4dd187c808e2f1c0ff7040e914abc7adeae2.tar.gz
bcfg2-decb4dd187c808e2f1c0ff7040e914abc7adeae2.tar.bz2
bcfg2-decb4dd187c808e2f1c0ff7040e914abc7adeae2.zip
Tools/__init__.py: Pylint/PEP8 fixes
Signed-off-by: Sol Jerome <sol.jerome@gmail.com> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@6038 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Tools/__init__.py')
-rw-r--r--src/lib/Client/Tools/__init__.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py
index 1216fb60a..1d89e6d02 100644
--- a/src/lib/Client/Tools/__init__.py
+++ b/src/lib/Client/Tools/__init__.py
@@ -24,8 +24,10 @@ class toolInstantiationError(Exception):
"""This error is called if the toolset cannot be instantiated."""
pass
+
class readonlypipe(popen2.Popen4):
"""This pipe sets up stdin --> /dev/null."""
+
def __init__(self, cmd, bufsize=-1):
popen2._cleanup()
c2pread, c2pwrite = os.pipe()
@@ -42,8 +44,10 @@ class readonlypipe(popen2.Popen4):
self.fromchild = os.fdopen(c2pread, 'r', bufsize)
popen2._active.append(self)
+
class executor:
"""This class runs stuff for us"""
+
def __init__(self, logger):
self.logger = logger
@@ -74,6 +78,7 @@ class executor:
# the value.
return ((cmdstat >> 8), output)
+
class Tool:
"""
All tools subclass this. It defines all interfaces that need to be defined.
@@ -85,7 +90,8 @@ class Tool:
__important__ = []
def __init__(self, logger, setup, config):
- self.__important__ = [entry.get('name') for struct in config for entry in struct \
+ self.__important__ = [entry.get('name') \
+ for struct in config for entry in struct \
if entry.tag == 'Path' and \
entry.get('important') in ['true', 'True']]
self.setup = setup
@@ -197,7 +203,6 @@ class Tool:
return False
return True
-
def FindExtra(self):
"""Return a list of extra entries."""
return []
@@ -222,6 +227,7 @@ class Tool:
return False
return True
+
class PkgTool(Tool):
"""
PkgTool provides a one-pass install with
@@ -265,7 +271,8 @@ class PkgTool(Tool):
if entry.tag == 'Package'
and entry.get('type') == self.pkgtype
and entry.get('name') in pkgnames]:
- self.logger.debug('Setting state to true for pkg %s' % (entry.get('name')))
+ self.logger.debug('Setting state to true for pkg %s' % \
+ (entry.get('name')))
states[entry] = True
self.RefreshPackages()
else:
@@ -275,7 +282,8 @@ class PkgTool(Tool):
for pkg in packages:
# handle state tracking updates
if self.VerifyPackage(pkg, []):
- self.logger.info("Forcing state to true for pkg %s" % (pkg.get('name')))
+ self.logger.info("Forcing state to true for pkg %s" % \
+ (pkg.get('name')))
states[pkg] = True
else:
self.logger.info("Installing pkg %s version %s" %
@@ -286,7 +294,8 @@ class PkgTool(Tool):
if cmdrc[0] == 0:
states[pkg] = True
else:
- self.logger.error("Failed to install package %s" % (pkg.get('name')))
+ self.logger.error("Failed to install package %s" % \
+ (pkg.get('name')))
self.RefreshPackages()
for entry in [ent for ent in packages if states[ent]]:
self.modified.append(entry)
@@ -308,6 +317,7 @@ class PkgTool(Tool):
type=self.pkgtype, version=version) \
for (name, version) in extras]
+
class SvcTool(Tool):
"""This class defines basic Service behavior"""
name = 'SvcTool'