summaryrefslogtreecommitdiffstats
path: root/src/lib/Server
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-10-25 20:22:58 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-10-25 20:22:58 +0000
commitfe4c4bba4671f11b3b2de9aa66c29987971e4fe1 (patch)
treef44800fc42ca0e942555b0c37bdec0a3b7ec8eaf /src/lib/Server
parentf2e9a361014c2f30058d4c1ed8a522404ddd9409 (diff)
downloadbcfg2-fe4c4bba4671f11b3b2de9aa66c29987971e4fe1.tar.gz
bcfg2-fe4c4bba4671f11b3b2de9aa66c29987971e4fe1.tar.bz2
bcfg2-fe4c4bba4671f11b3b2de9aa66c29987971e4fe1.zip
pylint fixes
(Logical change 1.113) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@508 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r--src/lib/Server/Generators/pkgmgr.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/Server/Generators/pkgmgr.py b/src/lib/Server/Generators/pkgmgr.py
index 4d3b6066f..fc4ae703c 100644
--- a/src/lib/Server/Generators/pkgmgr.py
+++ b/src/lib/Server/Generators/pkgmgr.py
@@ -1,12 +1,16 @@
#!/usr/bin/env python
-from re import compile
+'''This module implements a package management scheme for all images'''
+__revision__ = '$Revision$'
+
+from re import compile as regcompile
from Bcfg2.Server.Generator import Generator, DirectoryBacked, XMLFileBacked
class PackageEntry(XMLFileBacked):
+ '''PackageEntry is a set of packages and locations for a single image'''
__identifier__ = 'image'
- rpm = compile('^(?P<name>[\w\+\d\.]+(-[\w\+\d\.]+)*)-(?P<version>[\w\d\.]+-([\w\d\.]+))\.(?P<arch>\w+)\.rpm$')
+ rpm = regcompile('^(?P<name>[\w\+\d\.]+(-[\w\+\d\.]+)*)-(?P<version>[\w\d\.]+-([\w\d\.]+))\.(?P<arch>\w+)\.rpm$')
def Index(self):
XMLFileBacked.Index(self)
@@ -14,16 +18,16 @@ class PackageEntry(XMLFileBacked):
for location in self.entries:
for pkg in location.getchildren():
if pkg.attrib.has_key("file"):
- m = self.rpm.match(pkg.attrib['file'])
+ m = self.rpm.match(pkg.get('file'))
if not m:
- print "failed to rpm match %s"%(pkg.attrib['file'])
+ print "failed to rpm match %s" % (pkg.get('file'))
continue
self.packages[m.group('name')] = m.groupdict()
self.packages[m.group('name')]['file'] = pkg.attrib['file']
self.packages[m.group('name')]['uri'] = location.attrib['uri']
self.packages[m.group('name')]['type'] = 'rpm'
else:
- self.packages[pkg.attrib['name']] = pkg.attrib
+ self.packages[pkg.get('name')] = pkg.attrib
class PackageDir(DirectoryBacked):
__child__ = PackageEntry
@@ -35,20 +39,21 @@ class pkgmgr(Generator):
__author__ = 'bcfg-dev@mcs.anl.gov'
def __setup__(self):
- self.pkgdir=PackageDir(self.data,self.core.fam)
+ self.pkgdir = PackageDir(self.data, self.core.fam)
def FindHandler(self, entry):
if entry.tag != 'Package':
- raise KeyError, (entry.tag, entry.attrib['name'])
+ raise KeyError, (entry.tag, entry.get('name'))
return self.LocatePackage
def LocatePackage(self, entry, metadata):
- pkgname = entry.attrib['name']
- pl = self.pkgdir["%s.xml"%(metadata.image)]
+ '''Locates a package entry for particular metadata'''
+ pkgname = entry.get('name')
+ pl = self.pkgdir["%s.xml" % (metadata.image)]
if pl.packages.has_key(pkgname):
p = pl.packages[pkgname]
if p.get('type', None) == 'rpm':
- entry.attrib.update({'url':"%s/%s"%(p['uri'],p['file']), 'version':p['version']})
+ entry.attrib.update({'url':"%s/%s" % (p['uri'], p['file']), 'version':p['version']})
else:
entry.attrib.update(p)
else: