summaryrefslogtreecommitdiffstats
path: root/src/BcfgServer.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/BcfgServer.py')
-rw-r--r--src/BcfgServer.py29
1 files changed, 22 insertions, 7 deletions
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__()