From b9ac6e48c38beb674c18eae33c5b8a6f2eb39f33 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Thu, 27 Jan 2005 17:34:40 +0000 Subject: kill old debug message 2005/01/20 17:13:51-06:00 anl.gov!desai tighten up fam event propagation (Logical change 1.194) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@826 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Generators/Cfg.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/lib/Server/Generators/Cfg.py b/src/lib/Server/Generators/Cfg.py index f8d247e61..8f5aaff51 100644 --- a/src/lib/Server/Generators/Cfg.py +++ b/src/lib/Server/Generators/Cfg.py @@ -37,7 +37,7 @@ class FileEntry(FileBacked): class ConfigFileEntry(object): '''ConfigFileEntry is a repository entry for a single file, containing all data for all clients.''' - specific = regcompile('(.*/)(?P[\w\-.]+)\.((H_(?P\S+))|' + + specific = regcompile('(.*/)(?P[\S\-.]+)\.((H_(?P\S+))|' + '(B(?P\d+)_(?P\S+))|(A(?P\d+)_(?P\S+))|' + '(I(?P\d+)_(?P\S+))|(C(?P\d+)_(?P\S+)))' + '(\.(?Pcat|udiff))?$') @@ -45,9 +45,10 @@ class ConfigFileEntry(object): 'perms:(\s)*(?P\w+)|encoding:(\s)*(?P\w+)|' + '(?Pparanoid(\s)*)$') - def __init__(self, path): + def __init__(self, path, repopath): object.__init__(self) self.path = path + self.repopath = repopath self.basefiles = [] self.deltas = [] self.metadata = {'encoding': 'ascii', 'owner':'root', 'group':'root', 'perms':'0644'} @@ -55,7 +56,7 @@ class ConfigFileEntry(object): def read_info(self): '''read in :info metadata''' - filename = "%s/:info" % self.path + filename = "%s/:info" % self.repopath for line in open(filename).readlines(): match = self.info.match(line) if not match: @@ -109,6 +110,10 @@ class ConfigFileEntry(object): action = event.code2str() if event.filename == ':info': return self.read_info() + if event.filename != self.path.split('/')[-1]: + if not self.specific.match('/' + event.filename): + syslog(LOG_INFO, 'Cfg: Suppressing event for bogus file %s' % event.filename) + return for entry in self.basefiles + self.deltas: if entry.name.split('/')[-1] == event.filename: if action == 'changed': @@ -192,8 +197,9 @@ class Cfg(Generator): else: # file entries shouldn't contain path-to-repo shortname = '/'+ '/'.join(name[len(self.data)+1:].split('/')[:-1]) + repodir = '/' + '/'.join(name.split('/')[:-1]) if not self.entries.has_key(shortname): - self.entries[shortname] = ConfigFileEntry(shortname) + self.entries[shortname] = ConfigFileEntry(shortname, repodir) self.__provides__['ConfigFile'][shortname] = self.entries[shortname].GetConfigFile self.entries[shortname].AddEntry(name) self.entries[shortname].HandleEvent(event) @@ -202,7 +208,7 @@ class Cfg(Generator): '''Handle FAM updates''' action = event.code2str() if self.tempfile.match(event.filename): - syslog(LOG_INFO, "Suppressed event for file %s" % event.filename) + syslog(LOG_INFO, "Cfg: Suppressed event for file %s" % event.filename) return if event.filename[0] != '/': filename = "%s/%s" % (self.famID[event.requestID], event.filename) -- cgit v1.2.3-1-g7c22