From 6828f59d5f01d594a3ae570d8a69273ff09f6b71 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Tue, 3 Aug 2004 21:42:16 +0000 Subject: updates (Logical change 1.25) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@125 ce84e21b-d406-0410-9b95-82705330c041 --- src/BcfgServer.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/BcfgServer.py b/src/BcfgServer.py index 8a403ac5a..81fe72818 100644 --- a/src/BcfgServer.py +++ b/src/BcfgServer.py @@ -1,6 +1,9 @@ #!/usr/bin/env python # $Id: $ +from syslog import syslog, LOG_INFO +from time import time + from elementtree.ElementTree import Element, tostring from Bcfg2.Core import Core @@ -11,7 +14,8 @@ from sss.server import Server class MetadataStore(object): def __init__(self): - self.images = {'topaz':'debian-3.1'} + self.classes = {} + self.images = {'debian-3.1':['topaz']} self.tags = {'laptop':['topaz']} self.bundles = {'global':['ssh'], 'tags':{'laptop':[]}, 'hosts':{}} @@ -39,15 +43,17 @@ class BcfgServer(Server): return 1 def BuildConfig(self, xml, (peer,port)): + t = time() # get metadata for host config = Element("Configuration", version='2.0') - m = Metadata(False, 'chiba-rh73', ['ssh'], [], 'topaz') + 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) + 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) + syslog(LOG_INFO, "Generated config for %s in %s seconds"%(peer, time()-t)) return config def GetProbes(self, xml, (peer,port)): -- cgit v1.2.3-1-g7c22