diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-01-25 16:48:06 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-01-25 16:48:06 +0000 |
commit | e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92 (patch) | |
tree | 31d523f4849b2a3232f92c2142cdd35b96beb5e1 /src/lib/Server/Plugins/Hostbase.py | |
parent | edca0b698637c3fd0a70af7e4752a46afca938d3 (diff) | |
download | bcfg2-e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92.tar.gz bcfg2-e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92.tar.bz2 bcfg2-e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92.zip |
Introduce the new logging infrastructure and convert the server (and bcfg2-info) over to using it
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1717 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/Hostbase.py')
-rw-r--r-- | src/lib/Server/Plugins/Hostbase.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lib/Server/Plugins/Hostbase.py b/src/lib/Server/Plugins/Hostbase.py index e729030fb..96f215451 100644 --- a/src/lib/Server/Plugins/Hostbase.py +++ b/src/lib/Server/Plugins/Hostbase.py @@ -1,7 +1,6 @@ '''This file provides the Hostbase plugin. It manages dns/dhcp/nis host information''' __revision__ = '$Revision$' -from syslog import syslog, LOG_INFO from lxml.etree import XML, SubElement from Cheetah.Template import Template from Bcfg2.Server.Plugin import Plugin, PluginExecutionError, PluginInitError, DirectoryBacked @@ -9,6 +8,10 @@ from time import strftime from sets import Set import re +import logging + +logger = logging.getLogger('Bcfg2.Plugins.Hostbase') + class DataNexus(DirectoryBacked): '''DataNexus is an object that watches multiple files and handles changes in an intelligent fashion.''' @@ -23,7 +26,7 @@ class DataNexus(DirectoryBacked): action = event.code2str() if action in ['exists', 'created']: if (event.filename != self.name) and (event.filename not in self.files): - syslog(LOG_INFO, "%s:Got event for unexpected file %s" % (self.__name__, event.filename)) + logger.info("%s:Got event for unexpected file %s" % (self.__name__, event.filename)) return DirectoryBacked.HandleEvent(self, event) if action != 'endExist' and event.filename != self.name: @@ -48,7 +51,7 @@ class Hostbase(Plugin, DataNexus): DataNexus.__init__(self, datastore + '/Hostbase/data', files, self.core.fam) except: - self.LogError("Failed to load data directory") + logger.error("Failed to load data directory") raise PluginInitError self.xdata = {} self.filedata = {} @@ -96,12 +99,12 @@ class Hostbase(Plugin, DataNexus): todaydate = (strftime('%Y%m%d')) try: if todaydate == zone.get('serial')[:8]: - serial = atoi(zone.get('serial')) + 1 + serial = int(zone.get('serial')) + 1 else: - serial = atoi(todaydate) * 100 + serial = int(todaydate) * 100 return str(serial) except (KeyError): - serial = atoi(todaydate) * 100 + serial = int(todaydate) * 100 return str(serial) if self.entries.has_key(event.filename) and not self.xdata.has_key(event.filename): |