summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Core.py
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-08-15 12:35:26 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-08-15 12:35:26 -0500
commitf5d3b73b36712944558f5529785b29621cb5cc11 (patch)
tree7b8efd457a1327f4b11e05cc5138b1af6b265bb6 /src/lib/Bcfg2/Server/Core.py
parentaf44641c5511d35889fa4c25ffda0d2aa8eb4be6 (diff)
downloadbcfg2-f5d3b73b36712944558f5529785b29621cb5cc11.tar.gz
bcfg2-f5d3b73b36712944558f5529785b29621cb5cc11.tar.bz2
bcfg2-f5d3b73b36712944558f5529785b29621cb5cc11.zip
Core: add database_available flag to allow plugins to see availability
Diffstat (limited to 'src/lib/Bcfg2/Server/Core.py')
-rw-r--r--src/lib/Bcfg2/Server/Core.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index f25542eae..4465abb9a 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -102,14 +102,15 @@ class BaseCore(object):
# load plugins
Bcfg2.settings.read_config(cfile=self.cfile, repo=self.datastore)
+ self._database_available = False
# verify our database schema
try:
from Bcfg2.Server.SchemaUpdater import update_database, UpdaterError
try:
update_database()
+ self._database_available = True
except UpdaterError:
self.logger.error("Failed to update database schema")
- raise CoreInitError
except ImportError:
# assume django is not installed
pass
@@ -623,3 +624,9 @@ class BaseCore(object):
"""Get the data of the decision list."""
client, metadata = self.resolve_client(address)
return self.GetDecisions(metadata, mode)
+
+ @property
+ def database_available(self):
+ """Is the database configured and available"""
+ return self._database_available
+