summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Snapshots
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-02-08 19:24:37 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-02-08 19:24:37 +0000
commit42cffe6228369a75f27c14eea22ad13baf2c0854 (patch)
treeed3a19a831c3b54b9d472671814d7bf77ab16eb5 /src/lib/Server/Snapshots
parent8f265b38c7798d7933173d4dcbe9e6b3ad736c4c (diff)
downloadbcfg2-42cffe6228369a75f27c14eea22ad13baf2c0854.tar.gz
bcfg2-42cffe6228369a75f27c14eea22ad13baf2c0854.tar.bz2
bcfg2-42cffe6228369a75f27c14eea22ad13baf2c0854.zip
Snapshots: Use custom bcfg2.conf when specified (Fix for #839)
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5716 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Snapshots')
-rw-r--r--src/lib/Server/Snapshots/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/Server/Snapshots/__init__.py b/src/lib/Server/Snapshots/__init__.py
index c13dee42e..6018377cb 100644
--- a/src/lib/Server/Snapshots/__init__.py
+++ b/src/lib/Server/Snapshots/__init__.py
@@ -5,9 +5,9 @@ import sqlalchemy.orm
import ConfigParser
-def db_from_config(fname='/etc/bcfg2.conf'):
+def db_from_config(cfile):
cp = ConfigParser.ConfigParser()
- cp.read([fname])
+ cp.read([cfile])
driver = cp.get('snapshots', 'driver')
if driver == 'sqlite':
path = cp.get('snapshots', 'database')
@@ -22,8 +22,8 @@ def db_from_config(fname='/etc/bcfg2.conf'):
raise Exception, "unsupported db driver %s" % driver
-def setup_session(debug=False):
- engine = sqlalchemy.create_engine(db_from_config(),
+def setup_session(cfile, debug=False):
+ engine = sqlalchemy.create_engine(db_from_config(cfile),
echo=debug)
Session = sqlalchemy.orm.sessionmaker()
Session.configure(bind=engine)