summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Pellin <bpellin@mcs.anl.gov>2005-01-10 17:17:28 +0000
committerBrian Pellin <bpellin@mcs.anl.gov>2005-01-10 17:17:28 +0000
commit1e54f5cf6b8167187d9eaa1214f3144f31c74451 (patch)
tree9e4d1aa01bdc4aaf7126ba0e46c116261fd6231e
parent6c80aca7c9dc17c50c2335dec964751fd3ea1554 (diff)
downloadbcfg2-1e54f5cf6b8167187d9eaa1214f3144f31c74451.tar.gz
bcfg2-1e54f5cf6b8167187d9eaa1214f3144f31c74451.tar.bz2
bcfg2-1e54f5cf6b8167187d9eaa1214f3144f31c74451.zip
Made ConfigFileEntry handle exists events for initial data read in.
Adding message to log events that don't correspond to known files in ConfigFileEntry. (Logical change 1.183) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@783 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Generators/Cfg.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lib/Server/Generators/Cfg.py b/src/lib/Server/Generators/Cfg.py
index 14e46b7f8..77202fa03 100644
--- a/src/lib/Server/Generators/Cfg.py
+++ b/src/lib/Server/Generators/Cfg.py
@@ -113,10 +113,16 @@ class ConfigFileEntry(object):
if action == 'changed':
syslog(LOG_INFO, "Cfg: File %s changed" % event.filename)
entry.HandleEvent(event)
+ elif action == 'exists':
+ entry.HandleEvent(event)
elif action == 'deleted':
[flist.remove(entry) for flist in [self.basefiles, self.deltas] if entry in flist]
else:
- syslog(LOG_ERR, "Cfg: Unhandled Action %s for file %s" % (action, event.filename))
+ syslog(LOG_ERR, "Cfg: Unhandled Action '%s' for file %s" % (action, event.filename))
+ return
+
+ # This code is only reached when an event goes unhandled
+ syslog(LOG_ERR, "Cfg: Event '%s' when unhandled for file '%s'" %(action, event.filename))
def GetConfigFile(self, entry, metadata):
'''Fetch config file from repository'''
@@ -172,7 +178,7 @@ class Cfg(Generator):
self.famID[reqid] = name
self.directories.append(name)
- def AddEntry(self, name):
+ def AddEntry(self, name, event):
'''Add new entry to FAM structures'''
try:
sdata = stat(name)[ST_MODE]
@@ -188,7 +194,7 @@ class Cfg(Generator):
self.entries[shortname] = ConfigFileEntry(shortname)
self.__provides__['ConfigFile'][shortname] = self.entries[shortname].GetConfigFile
self.entries[shortname].AddEntry(name)
- #self.entries[shortname].HandleEvent()
+ self.entries[shortname].HandleEvent(event)
def HandleEvent(self, event):
'''Handle FAM updates'''
@@ -199,17 +205,17 @@ class Cfg(Generator):
filename = event.filename
configfile = filename[len(self.data):-(len(event.filename)+1)]
+ if event.filename == ':info':
+ event.filename = filename
if ((action in ['exists', 'created']) and (filename != self.data)):
- self.AddEntry(filename)
+ self.AddEntry(filename, event)
elif action == 'changed':
# pass the event down the chain to the ConfigFileEntry
- if event.filename == ':info':
- event.filename = filename
if self.entries.has_key(configfile):
self.entries[configfile].HandleEvent(event)
else:
if filename != self.data:
- self.AddEntry(filename)
+ self.AddEntry(filename, event)
else:
self.LogError("Ignoring event for %s"%(configfile))
elif action == 'deleted':