From c038f0ceca6779fa429d6f74f0c794498a826c7e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 9 Nov 2012 15:00:17 +0100 Subject: pingdata.xml: add new file for dynamic ping data of the clients bcfg2-ping-sweep saved the pingdata into clients.xml. This is problematic if the repository is tracked by a vcs. Now the dynamic data is saved into pingdata.xml and the DBStat plugin reads the data from there. So the pingdata.xml could be ignored by the vcs. --- src/lib/Server/Plugins/Metadata.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/lib/Server/Plugins/Metadata.py') diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py index 4f0ca9686..f89c98d2c 100644 --- a/src/lib/Server/Plugins/Metadata.py +++ b/src/lib/Server/Plugins/Metadata.py @@ -237,16 +237,19 @@ class Metadata(Bcfg2.Server.Plugin.Plugin, try: core.fam.AddMonitor("%s/%s" % (self.data, "groups.xml"), self) core.fam.AddMonitor("%s/%s" % (self.data, "clients.xml"), self) + core.fam.AddMonitor("%s/%s" % (self.data, "pingdata.xml"), self) except: - print("Unable to add file monitor for groups.xml or clients.xml") + print("Unable to add file monitor for groups.xml, clients.xml or pingdata.xml") raise Bcfg2.Server.Plugin.PluginInitError self.clients_xml = XMLMetadataConfig(self, watch_clients, 'clients.xml') + self.pingdata_xml = XMLMetadataConfig(self, watch_clients, 'pingdata.xml') self.groups_xml = XMLMetadataConfig(self, watch_clients, 'groups.xml') self.states = {} if watch_clients: self.states = {"groups.xml": False, - "clients.xml": False} + "clients.xml": False, + "pingdata.xml": False} self.addresses = {} self.auth = dict() self.clients = {} @@ -266,7 +269,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin, self.default = None self.pdirty = False self.extra = {'groups.xml': [], - 'clients.xml': []} + 'clients.xml': [], + 'pingdata.xml': []} self.password = core.password self.query = MetadataQuery(core.build_metadata, lambda: list(self.clients.keys()), @@ -530,6 +534,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin, ggg)) [self.groups[group][0].add(bund) for bund in bundles] self.states['groups.xml'] = True + elif self.pingdata_xml.HandleEvent(event): + self.states['pingdata.xml'] = True if False not in list(self.states.values()): # check that all client groups are real and complete real = list(self.groups.keys()) -- cgit v1.2.3-1-g7c22