summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-10-22 03:25:58 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-10-22 03:25:58 +0000
commit93fa7d7fbaca09548cdf77e6ad761210d20cea3b (patch)
tree45a9dc719c8006a6b41c3a8969e606eb8764e275 /src
parentc97573fada72589872199db6fbd714965015f1dc (diff)
downloadbcfg2-93fa7d7fbaca09548cdf77e6ad761210d20cea3b.tar.gz
bcfg2-93fa7d7fbaca09548cdf77e6ad761210d20cea3b.tar.bz2
bcfg2-93fa7d7fbaca09548cdf77e6ad761210d20cea3b.zip
pylint fixups
(Logical change 1.109) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@486 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Structure.py4
-rw-r--r--src/lib/Server/Structures/bundler.py18
2 files changed, 14 insertions, 8 deletions
diff --git a/src/lib/Server/Structure.py b/src/lib/Server/Structure.py
index 2462de8dd..74bbbdb15 100644
--- a/src/lib/Server/Structure.py
+++ b/src/lib/Server/Structure.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+'''This is the Structure base class'''
__revision__ = '$Revision$'
class Structure(object):
@@ -9,6 +10,7 @@ class Structure(object):
__name__ = 'example'
def __init__(self, core, datastore):
+ '''Common structure setup'''
self.data = "%s/%s"%(datastore,self.__name__)
self.core = core
self.__setup__()
@@ -16,7 +18,7 @@ class Structure(object):
def __setup__(self):
pass
- def Construct(self, metadata, subset):
+ def Construct(self, metadata):
'''Returns a list of configuration structure chunks for client'''
return []
diff --git a/src/lib/Server/Structures/bundler.py b/src/lib/Server/Structures/bundler.py
index dfb951971..d4a90391f 100644
--- a/src/lib/Server/Structures/bundler.py
+++ b/src/lib/Server/Structures/bundler.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
-# $Id: $
+
+'''This provides bundle clauses with translation functionality'''
+__revision__ = '$Revision$'
from copy import deepcopy
from syslog import LOG_ERR, syslog
@@ -7,18 +9,20 @@ from syslog import LOG_ERR, syslog
from Bcfg2.Server.Generator import SingleXMLFileBacked, XMLFileBacked, DirectoryBacked
from Bcfg2.Server.Structure import Structure
-from elementtree.ElementTree import Element, XML, tostring
+from elementtree.ElementTree import Element, XML
class ImageFile(SingleXMLFileBacked):
+ '''This file contains image -> system mappings'''
def Index(self):
+ '''Build data structures out of the data'''
a = XML(self.data)
self.attr = a.attrib
self.entries = a.getchildren()
self.images = {}
for child in self.entries:
- (name, package, service) = map(lambda x:child.attrib.get(x), ['name', 'package', 'service'])
+ [name, pkg, service] = [child.get(x) for x in ['name', 'package', 'service']]
for grandchild in child.getchildren():
- self.images[grandchild.attrib['name']] = (name, package, service)
+ self.images[grandchild.get('name')] = (name, pkg, service)
class Bundle(XMLFileBacked):
def Index(self):
@@ -31,12 +35,12 @@ class Bundle(XMLFileBacked):
if entry.tag == 'System':
self.systems[entry.attrib['name']] = entry.getchildren()
elif entry.tag == 'Attribute':
- self.attributes["%s.%s"%(entry.attrib['scope'], entry.attrib['name'])] = entry.getchildren()
+ self.attributes["%s.%s" % (entry.get('scope'), entry.get('name'))] = entry.getchildren()
else:
self.all.append(entry)
del self.data
- def BuildBundle(self,metadata, system):
+ def BuildBundle(self, metadata, system):
bundlename = self.name[:-4]
b = Element('Bundle', name=bundlename)
for entry in self.all + self.systems.get(system, []):
@@ -68,7 +72,7 @@ class bundler(Structure):
syslog(LOG_ERR, "Client %s requested nonexistent bundle %s"%(metadata.hostname, bundlename))
continue
- bundle = self.bundles.entries["%s.xml"%(bundlename)].BuildBundle(metadata, system)
+ bundle = self.bundles.entries["%s.xml" % (bundlename)].BuildBundle(metadata, system)
# now we need to populate service/package types
for entry in bundle.getchildren():
if entry.tag == 'Package':