diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2004-12-15 02:17:35 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2004-12-15 02:17:35 +0000 |
commit | 72b3f7721d90ce50795c3ea2667a41e9a93d5b3e (patch) | |
tree | 9d53e7ce9ff5f16a04e99c04c405cdfe473e5e95 | |
parent | 12cc2eef87c264eac5babf84775a1a162719e7ab (diff) | |
download | bcfg2-72b3f7721d90ce50795c3ea2667a41e9a93d5b3e.tar.gz bcfg2-72b3f7721d90ce50795c3ea2667a41e9a93d5b3e.tar.bz2 bcfg2-72b3f7721d90ce50795c3ea2667a41e9a93d5b3e.zip |
Add logging mechanism
2004/12/14 19:14:32-06:00 anl.gov!desai
add GeneratorInitError
2004/12/14 18:33:58-06:00 anl.gov!desai
add Generator Exception
(Logical change 1.160)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@706 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/lib/Server/Generator.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/Server/Generator.py b/src/lib/Server/Generator.py index 0089df111..6581e649c 100644 --- a/src/lib/Server/Generator.py +++ b/src/lib/Server/Generator.py @@ -5,6 +5,15 @@ from elementtree.ElementTree import XML from syslog import syslog, LOG_ERR from xml.parsers.expat import ExpatError +class GeneratorError(Exception): + '''Generator runtime error used to inform upper layers of internal generator failure''' + pass + +class GeneratorInitError(Exception): + '''Constructor time error that allows the upper layer to proceed in the face of + generator initialization failures''' + pass + class Generator(object): '''This is a class that generators can be subclassed from. __name__, __version__, and __author__ must be set for the module @@ -24,6 +33,9 @@ class Generator(object): self.data = "%s/%s" % (datastore, self.__name__) self.external = {} + def LogError(self, msg): + syslog(LOG_ERR, "%s: %s" % (self.__name__, msg)) + def CompleteSetup(self): '''Read any external required publication data''' self.ReadAll() |