summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Reports
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-05-18 17:17:47 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-05-18 17:17:47 -0500
commitcb35bada0faa9f8fa489fd625a7a7464918fb4c0 (patch)
tree7c20ecd6c8a1de39f549bc1a0fcc759395904c97 /src/lib/Bcfg2/Server/Reports
parentafeebe721ce4bacf1bfec532816b3cd5d1e2de83 (diff)
downloadbcfg2-cb35bada0faa9f8fa489fd625a7a7464918fb4c0.tar.gz
bcfg2-cb35bada0faa9f8fa489fd625a7a7464918fb4c0.tar.bz2
bcfg2-cb35bada0faa9f8fa489fd625a7a7464918fb4c0.zip
Reports: Use config file from the command line
If a config file is specified on the command line, use it in settings.py instead of the hardcoded ones.
Diffstat (limited to 'src/lib/Bcfg2/Server/Reports')
-rw-r--r--src/lib/Bcfg2/Server/Reports/settings.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Reports/settings.py b/src/lib/Bcfg2/Server/Reports/settings.py
index 26bd5076e..9eb558ac8 100644
--- a/src/lib/Bcfg2/Server/Reports/settings.py
+++ b/src/lib/Bcfg2/Server/Reports/settings.py
@@ -1,11 +1,16 @@
import django
+import os
import sys
# Compatibility import
from Bcfg2.Bcfg2Py3k import ConfigParser
# Django settings for bcfg2 reports project.
c = ConfigParser.ConfigParser()
-if len(c.read(['/etc/bcfg2.conf', '/etc/bcfg2-web.conf'])) == 0:
+if 'BCFG2_CONFIG_FILE' in os.environ:
+ cfiles=os.environ['BCFG2_CONFIG_FILE']
+else:
+ cfiles=['/etc/bcfg2.conf', '/etc/bcfg2-web.conf']
+if len(c.read(cfiles)) == 0:
raise ImportError("Please check that bcfg2.conf or bcfg2-web.conf exists "
"and is readable by your web server.")