summaryrefslogtreecommitdiffstats
path: root/generators
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-08-02 18:25:00 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-08-02 18:25:00 +0000
commit045805d18bc2bad75df331dfa71fa1f52430bf67 (patch)
treecd1d2e03ac4e958251a424524352d245c6943b1c /generators
parent069e01e32f5d20ad7a588ca59a95d132ca3f6f35 (diff)
downloadbcfg2-045805d18bc2bad75df331dfa71fa1f52430bf67.tar.gz
bcfg2-045805d18bc2bad75df331dfa71fa1f52430bf67.tar.bz2
bcfg2-045805d18bc2bad75df331dfa71fa1f52430bf67.zip
switch to new API
(Logical change 1.24) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@120 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'generators')
-rw-r--r--generators/servicemgr.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/generators/servicemgr.py b/generators/servicemgr.py
index 40c4ffc47..98d3aa274 100644
--- a/generators/servicemgr.py
+++ b/generators/servicemgr.py
@@ -1,8 +1,18 @@
#!/usr/bin/env python
from Generator import Generator
-from GeneratorUtils import DirectoryBacked
-from Types import Service
+from GeneratorUtils import XMLFileBacked
+
+
+class ServiceList(XMLFileBacked):
+ def __init__(self, filename, fam):
+ XMLFileBacked.__init__(self, filename)
+ fam.AddMonitor(filename)
+
+ def Index(self):
+ a = XML(self.data)
+ self.name = a.attrib['name']
+ self.entries = a.getchildren()
class servicemgr(Generator):
'''This is a generator that handles service assignments'''
@@ -10,12 +20,14 @@ class servicemgr(Generator):
__version__ = '$Id$'
__author__ = 'bcfg-dev@mcs.anl.gov'
- __provides__ = {'Service':{'sshd':'GetService'}}
+ def __setup__(self):
+ self.__provides__ = {'Service':{'sshd':self.GetService}}
+ #self.datafile = ServiceList("%s/packages.xml"%(self.data))
+ pass
- def GetService(self,name,metadata):
+ def GetService(self,entry,metadata):
# for now sshd is on
- if name == 'sshd':
- return Service('sshd','chkconfig','on','global')
- else:
- return Service(name,'chkconfig','off','local')
+ if entry.attrib['name'] == 'sshd':
+ entry.attrib['status'] = 'on'
+