diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-10-30 10:22:02 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-01-17 10:41:27 -0500 |
commit | 0fc1f472a0fb18911bde1cb99f03142681804476 (patch) | |
tree | c957495030e716a8d950dba803b15dc01428babc /src/lib/Bcfg2/Server/Snapshots/__init__.py | |
parent | 78dfedb4b450005246508cea08874637fcc86885 (diff) | |
download | bcfg2-0fc1f472a0fb18911bde1cb99f03142681804476.tar.gz bcfg2-0fc1f472a0fb18911bde1cb99f03142681804476.tar.bz2 bcfg2-0fc1f472a0fb18911bde1cb99f03142681804476.zip |
removed deprecated plugins: TGenshi, TCheetah, Account, Hostbase, Snapshots, Statistics, Editor
Diffstat (limited to 'src/lib/Bcfg2/Server/Snapshots/__init__.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Snapshots/__init__.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/lib/Bcfg2/Server/Snapshots/__init__.py b/src/lib/Bcfg2/Server/Snapshots/__init__.py deleted file mode 100644 index d42aa0525..000000000 --- a/src/lib/Bcfg2/Server/Snapshots/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -__all__ = ['models', 'db_from_config', 'setup_session'] - -import sqlalchemy -import sqlalchemy.orm -# Compatibility import -from Bcfg2.Compat import ConfigParser - - -def db_from_config(cfile): - cp = ConfigParser.ConfigParser() - cp.read([cfile]) - driver = cp.get('snapshots', 'driver') - 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("unsupported db driver %s" % driver) - - -def setup_session(cfile, debug=False): - engine = sqlalchemy.create_engine(db_from_config(cfile), - echo=debug) - Session = sqlalchemy.orm.sessionmaker() - Session.configure(bind=engine) - return Session() |