summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Reports
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-05-21 15:52:19 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-05-21 15:53:47 -0500
commit2e1a8182ae0bffc5f57fb0ea5fc75acb0d31ada1 (patch)
treeece7e6639077ebcf8e14da4e59d80ee8d694b5ef /src/lib/Bcfg2/Server/Reports
parent58a7bce0d7c4e19e0364adf365ba3528f4a2c197 (diff)
downloadbcfg2-2e1a8182ae0bffc5f57fb0ea5fc75acb0d31ada1.tar.gz
bcfg2-2e1a8182ae0bffc5f57fb0ea5fc75acb0d31ada1.tar.bz2
bcfg2-2e1a8182ae0bffc5f57fb0ea5fc75acb0d31ada1.zip
Reports: Parse cfile from command line instead of using an env variable
Diffstat (limited to 'src/lib/Bcfg2/Server/Reports')
-rw-r--r--src/lib/Bcfg2/Server/Reports/settings.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Reports/settings.py b/src/lib/Bcfg2/Server/Reports/settings.py
index 9eb558ac8..eb22f29f9 100644
--- a/src/lib/Bcfg2/Server/Reports/settings.py
+++ b/src/lib/Bcfg2/Server/Reports/settings.py
@@ -1,15 +1,21 @@
import django
import os
import sys
+import getopt
+import Bcfg2.Options
+
+
+cfile_opt=Bcfg2.Options.CFILE
+cfiles=[cfile_opt.default, '/etc/bcfg2-web.conf']
+for i in range(1, len(sys.argv)):
+ if sys.argv[i] == cfile_opt.cmd:
+ cfiles = sys.argv[i+1]
+ break
# Compatibility import
from Bcfg2.Bcfg2Py3k import ConfigParser
# Django settings for bcfg2 reports project.
c = ConfigParser.ConfigParser()
-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.")