From cb35bada0faa9f8fa489fd625a7a7464918fb4c0 Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Fri, 18 May 2012 17:17:47 -0500 Subject: 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. --- src/lib/Bcfg2/Server/Reports/settings.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lib/Bcfg2/Server/Reports') 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.") -- cgit v1.2.3-1-g7c22