From 9c7ec661cb558e74e5f669d534346f2a5c7b3777 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 2 Aug 2004 18:25:00 +0000 Subject: basically working (Logical change 1.24) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@113 ce84e21b-d406-0410-9b95-82705330c041 --- src/BcfgServer.py | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/BcfgServer.py b/src/BcfgServer.py index 9ad2d90b3..8a403ac5a 100644 --- a/src/BcfgServer.py +++ b/src/BcfgServer.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # $Id: $ +from elementtree.ElementTree import Element, tostring + from Bcfg2.Core import Core from Bcfg2.Metadata import Metadata @@ -22,8 +24,9 @@ class MetadataStore(object): class BcfgServer(Server): __implementation__ = 'Bcfg2' __component__ = 'bcfg2' - __dispatch__ = {'get-config':'GetConfig'} + __dispatch__ = {'get-config':'BuildConfig', 'get-probes':'GetProbes', 'probe-data':'CommitProbeData'} __statefields__ = ['metadata'] + __validate__ = 0 def __setup__(self): self.metadata = MetadataStore() @@ -33,15 +36,27 @@ class BcfgServer(Server): def __progress__(self): while self.core.fam.fm.pending(): self.core.fam.HandleEvent() + return 1 def BuildConfig(self, xml, (peer,port)): # get metadata for host - # m = Metadata(???) - for s in self.core.GetStructures(m): - # build the actual config - pass + config = Element("Configuration", version='2.0') + m = Metadata(False, 'chiba-rh73', ['ssh'], [], 'topaz') + structures = self.core.GetStructures(m) + # for s in structures: + # self.core.BindStructure(s, m) + # config.append(s) + # for x in s.getchildren(): + # print x.attrib['name'], '\000' in tostring(x) + return config + + def GetProbes(self, xml, (peer,port)): + return Element("probes") + + def CommitProbeData(self, xml, (peer,port)): + return Element("success") if __name__ == '__main__': server = BcfgServer() - while server.core.fam.fm.pending(): - server.core.fam.HandleEvent() + for i in range(10): + server.__progress__() -- cgit v1.2.3-1-g7c22