summaryrefslogtreecommitdiffstats
path: root/generators
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-08-11 20:40:57 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-08-11 20:40:57 +0000
commit4601c986e8a5794d38a753dfc740a70e06af72da (patch)
treed43409011de4251847068b7b32f82337db6b00fe /generators
parent891f846bb43499777fdc3573d40bd761bc8910cf (diff)
downloadbcfg2-4601c986e8a5794d38a753dfc740a70e06af72da.tar.gz
bcfg2-4601c986e8a5794d38a753dfc740a70e06af72da.tar.bz2
bcfg2-4601c986e8a5794d38a753dfc740a70e06af72da.zip
Rename: generators/pkgmgr.py -> src/lib/Server/Generators/pkgmgr.py
}(Logical change 1.37) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@219 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'generators')
-rw-r--r--generators/pkgmgr.py55
1 files changed, 0 insertions, 55 deletions
diff --git a/generators/pkgmgr.py b/generators/pkgmgr.py
deleted file mode 100644
index 85dd9ea48..000000000
--- a/generators/pkgmgr.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python
-
-from re import compile
-
-from Generator import Generator
-from GeneratorUtils import DirectoryBacked, XMLFileBacked
-from Types import Package
-
-class PackageEntry(XMLFileBacked):
- __identifier__ = 'image'
- rpm = compile('^(?P<name>[\w\+\d\.]+(-[\w\+\d\.]+)*)-(?P<version>[\w\d\.]+-([\w\d\.]+))\.(?P<arch>\w+)\.rpm$')
-
- def Index(self):
- XMLFileBacked.Index(self)
- self.packages = {}
- for location in self.entries:
- for pkg in location.getchildren():
- if pkg.attrib.has_key("file"):
- m = self.rpm.match(pkg.attrib['file'])
- if not m:
- print "failed to rpm match %s"%(pkg.attrib['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
-
-class PackageDir(DirectoryBacked):
- __child__ = PackageEntry
-
-class pkgmgr(Generator):
- '''This is a generator that handles service assignments'''
- __name__ = 'pkgmgr'
- __version__ = '$Id$'
- __author__ = 'bcfg-dev@mcs.anl.gov'
-
- def __setup__(self):
- self.pkgdir=PackageDir(self.data,self.core.fam)
-
- def FindHandler(self, entry):
- if entry.tag != 'Package':
- raise KeyError, (entry.tag, entry.attrib['name'])
- return self.LocatePackage
-
- def LocatePackage(self, entry, metadata):
- pkgname = entry.attrib['name']
- pl = self.pkgdir["%s.xml"%(metadata.image)]
- if pl.packages.has_key(pkgname):
- p = pl.packages[pkgname]
- if p['type'] == 'rpm':
- entry.attrib.update({'url':"%s/%s"%(p['uri'],p['file']), 'version':p['version']})
- else:
- raise KeyError, ("Package", name)