summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey Hagedorn <hagedorn@mcs.anl.gov>2007-06-25 21:49:10 +0000
committerJoey Hagedorn <hagedorn@mcs.anl.gov>2007-06-25 21:49:10 +0000
commit69ae493b872a61003b0ff53d69e23b669102f47e (patch)
treef542e105da78ee3bac156d4b10eb0e1dc2479afa
parent5dc9881ac52e2a6cb9c326931a0e5c92f138c74f (diff)
downloadbcfg2-69ae493b872a61003b0ff53d69e23b669102f47e.tar.gz
bcfg2-69ae493b872a61003b0ff53d69e23b669102f47e.tar.bz2
bcfg2-69ae493b872a61003b0ff53d69e23b669102f47e.zip
moved reporting system configuration to /etc/bcfg2.conf
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3366 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--examples/bcfg2.conf14
-rw-r--r--src/lib/Server/Reports/settings.py29
2 files changed, 35 insertions, 8 deletions
diff --git a/examples/bcfg2.conf b/examples/bcfg2.conf
index db3bb8a3f..da19e30d8 100644
--- a/examples/bcfg2.conf
+++ b/examples/bcfg2.conf
@@ -5,6 +5,20 @@ generators = SSHbase,Cfg,Pkgmgr,Svcmgr
[statistics]
sendmailpath = /usr/sbin/sendmail
+database_engine = sqlite3
+# 'postgresql', 'mysql', 'mysql_old', 'sqlite3' or 'ado_mssql'.
+database_name =
+# Or path to database file if using sqlite3.
+#<repository>/etc/brpt.sqlite is default path if left empty
+database_user =
+# Not used with sqlite3.
+database_password =
+# Not used with sqlite3.
+database_host =
+# Not used with sqlite3.
+database_port =
+# Set to empty string for default. Not used with sqlite3.
+web_debug = True
[communication]
protocol = xmlrpc/ssl
diff --git a/src/lib/Server/Reports/settings.py b/src/lib/Server/Reports/settings.py
index df781c890..0e7dbe3c5 100644
--- a/src/lib/Server/Reports/settings.py
+++ b/src/lib/Server/Reports/settings.py
@@ -2,9 +2,12 @@
from ConfigParser import ConfigParser, NoSectionError, NoOptionError
c = ConfigParser()
c.read(['/etc/bcfg2.conf'])#This needs to be configurable one day somehow
-sqlitedbpath = "%s/etc/brpt.sqlite" % c.get('server', 'repository')
-DEBUG = True
+if c.get('statistics', 'web_debug') == "True":
+ DEBUG = True
+else:
+ DEBUG = False
+
TEMPLATE_DEBUG = DEBUG
ADMINS = (
@@ -13,12 +16,22 @@ ADMINS = (
MANAGERS = ADMINS
-DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
-DATABASE_NAME = sqlitedbpath # Or path to database file if using sqlite3.
-DATABASE_USER = '' # Not used with sqlite3.
-DATABASE_PASSWORD = '' # Not used with sqlite3.
-DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
+DATABASE_ENGINE = c.get('statistics', 'database_engine')
+# 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
+DATABASE_NAME = c.get('statistics', 'database_name')
+# Or path to database file if using sqlite3.
+#<repository>/etc/brpt.sqlite is default path
+DATABASE_USER = c.get('statistics', 'database_user')
+# Not used with sqlite3.
+DATABASE_PASSWORD = c.get('statistics', 'database_password')
+# Not used with sqlite3.
+DATABASE_HOST = c.get('statistics', 'database_host')
+# Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = c.get('statistics', 'database_port')
+# Set to empty string for default. Not used with sqlite3.
+
+if DATABASE_ENGINE == 'sqlite3' and DATABASE_NAME == '':
+ DATABASE_NAME = "%s/etc/brpt.sqlite" % c.get('server', 'repository')
# Local time zone for this installation. All choices can be found here:
# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE