From febcfaad2e7a7dc5e15f397bf1a5aea05d40b865 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Mon, 13 Jul 2009 20:35:31 +0000 Subject: TCheetah: Remove RPM python-cheetah requirement Cheetah is not considered a requirement on the server. A check has been added to see if it is installed when trying to instantiate the TCheetah plugin. Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5324 ce84e21b-d406-0410-9b95-82705330c041 --- redhat/bcfg2.spec.in | 1 - src/lib/Server/Plugins/TCheetah.py | 13 +++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/redhat/bcfg2.spec.in b/redhat/bcfg2.spec.in index 6133d26cd..ca3c8b531 100644 --- a/redhat/bcfg2.spec.in +++ b/redhat/bcfg2.spec.in @@ -73,7 +73,6 @@ Requires: bcfg2 = %{version}-%{release} Requires: /usr/bin/openssl Requires: gamin-python Requires: python-genshi -Requires: python-cheetah Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Requires(preun): /sbin/service diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py index 9065b5ceb..ab87d24d5 100644 --- a/src/lib/Server/Plugins/TCheetah.py +++ b/src/lib/Server/Plugins/TCheetah.py @@ -1,12 +1,14 @@ '''This module implements a templating generator based on Cheetah''' __revision__ = '$Revision$' -import Cheetah.Template, Cheetah.Parser -import logging, sys, traceback +import logging +import sys +import traceback import Bcfg2.Server.Plugin logger = logging.getLogger('Bcfg2.Plugins.TCheetah') + class TemplateFile: '''Template file creates Cheetah template structures for the loaded file''' def __init__(self, name, specific, encoding): @@ -60,3 +62,10 @@ class TCheetah(Bcfg2.Server.Plugin.GroupSpool): filename_pattern = 'template' es_child_cls = TemplateFile + def __init__(self, core, datastore): + try: + import Cheetah.Template + import Cheetah.Parser + except: + logger.error("Failed to import TCheetah. Is it installed?") + raise Bcfg2.Server.Plugin.PluginInitError -- cgit v1.2.3-1-g7c22