From b6c9928eced9b725d936260d003026f1ebfa455d Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 5 May 2011 11:10:29 -0500 Subject: Core: Raise error on failed lxml import (Reported by Raul Cuza on IRC) Signed-off-by: Sol Jerome --- doc/help/faq/general.txt | 2 +- doc/help/troubleshooting.txt | 6 ++++++ doc/installation/prerequisites.txt | 2 +- src/lib/Server/Core.py | 6 +++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/help/faq/general.txt b/doc/help/faq/general.txt index ae53ca399..ba5d1fda3 100644 --- a/doc/help/faq/general.txt +++ b/doc/help/faq/general.txt @@ -29,7 +29,7 @@ exact list of platforms on which Bcfg2 works. **What pre-requisites are needed to run Bcfg2?** -Please visit the :ref:`prerequisites` section in the manual. +Please visit the :ref:`installation-prerequisites` section in the manual. **Why won't bcfg2-server start?** diff --git a/doc/help/troubleshooting.txt b/doc/help/troubleshooting.txt index d758ca7a5..88a0febc5 100644 --- a/doc/help/troubleshooting.txt +++ b/doc/help/troubleshooting.txt @@ -148,6 +148,10 @@ be taken to remedy them. | [list of unknown entries] | | has no knowledge of | | | | | the listed entries | | +------------------------------+----------+---------------------+--------------+ +| Failed to import lxml | Server | The server cannot | [12]_ | +| dependency. Shutting | | import lxml | | +| down server. | | | | ++------------------------------+----------+---------------------+--------------+ .. [1] This entry is not being bound. Ensure that a version of this @@ -179,6 +183,8 @@ be taken to remedy them. ignore the message as the Packages plugin has no knowledge of these packages (however, note that this package is most often specified as a BoundPackage entry). +.. [12] Ensure that you have installed all the necessary + :ref:`installation-prerequisites`. FAQs ==== diff --git a/doc/installation/prerequisites.txt b/doc/installation/prerequisites.txt index deeaba203..be7ec6c85 100644 --- a/doc/installation/prerequisites.txt +++ b/doc/installation/prerequisites.txt @@ -1,6 +1,6 @@ .. -*- mode: rst -*- -.. _prerequisites: +.. _installation-prerequisites: Prerequisites ============= diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index ac0a51e23..8f9d3e746 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -3,11 +3,15 @@ __revision__ = '$Revision$' import atexit import logging -import lxml.etree import select import sys import threading import time +try: + import lxml.etree +except ImportError: + print("Failed to import lxml dependency. Shutting down server.") + raise SystemExit(1) from Bcfg2.Component import Component, exposed from Bcfg2.Server.Plugin import PluginInitError, PluginExecutionError -- cgit v1.2.3-1-g7c22