summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Snapshots
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Snapshots')
-rw-r--r--src/lib/Server/Snapshots/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/Server/Snapshots/__init__.py b/src/lib/Server/Snapshots/__init__.py
index b94511ebd..2168ee55f 100644
--- a/src/lib/Server/Snapshots/__init__.py
+++ b/src/lib/Server/Snapshots/__init__.py
@@ -9,8 +9,14 @@ def db_from_config(fname='/etc/bcfg2.conf'):
if driver == 'sqlite':
path = cp.get('snapshots', 'database')
return 'sqlite:///%s' % path
+ elif driver in ['mysql', 'postgres']:
+ user = cp.get('snapshots', 'user')
+ password = cp.get('snapshots', 'password')
+ host = cp.get('snapshots', 'host')
+ db = cp.get('snapshots', 'database')
+ return '%s://%s:%s@%s/@s' % (driver, user, password, host, db)
else:
- raise Exception, "not done yet"
+ raise Exception, "unsupported db driver %s" % driver
def setup_session(debug=False):