summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin/Snapshots.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-03-06 21:13:08 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-03-06 21:13:08 +0000
commita738db564d19184b61d45fca3985dc285ee03ba8 (patch)
tree925ad2208ffc1cc790118a9e6bbc0aa8efd326c4 /src/lib/Server/Admin/Snapshots.py
parentd60154796408589b68350a34e25ee8d4efb03a78 (diff)
downloadbcfg2-a738db564d19184b61d45fca3985dc285ee03ba8.tar.gz
bcfg2-a738db564d19184b61d45fca3985dc285ee03ba8.tar.bz2
bcfg2-a738db564d19184b61d45fca3985dc285ee03ba8.zip
Snapshots: Add some convenience functions for getting access to latest snapshot
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5109 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin/Snapshots.py')
-rw-r--r--src/lib/Server/Admin/Snapshots.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/Server/Admin/Snapshots.py b/src/lib/Server/Admin/Snapshots.py
index fc3334c11..13897fcd2 100644
--- a/src/lib/Server/Admin/Snapshots.py
+++ b/src/lib/Server/Admin/Snapshots.py
@@ -2,15 +2,16 @@ import Bcfg2.Server.Admin
import sqlalchemy, sqlalchemy.orm
import Bcfg2.Server.Snapshots
import Bcfg2.Server.Snapshots.model
+from Bcfg2.Server.Snapshots.model import Snapshot, Client, Metadata, Base, Group
class Snapshots(Bcfg2.Server.Admin.Mode):
__shorthelp__ = "Interact with the Snapshots system"
__longhelp__ = (__shorthelp__)
__usage__ = ("bcfg2-admin snapshots [init|query qtype] ")
- q_dispatch = {'client':Bcfg2.Server.Snapshots.model.Client,
+ q_dispatch = {'client':Client,
'group':Bcfg2.Server.Snapshots.model.Group,
- 'snapshot':Bcfg2.Server.Snapshots.model.Snapshot,
+ 'snapshot':Snapshot,
}
def __init__(self, configfile):
@@ -30,9 +31,12 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
elif args[0] == 'init':
dbpath = Bcfg2.Server.Snapshots.db_from_config()
engine = sqlalchemy.create_engine(dbpath, echo=True)
- metadata = Bcfg2.Server.Snapshots.model.Base.metadata
+ metadata = Base.metadata
metadata.create_all(engine)
Session = sqlalchemy.orm.sessionmaker()
Session.configure(bind=engine)
session = Session()
session.commit()
+ elif args[0] == 'dump':
+ client, etype, ename = args[1:]
+ snap = Snapshot.get_current(self.session, client)