summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Snapshots
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-03-21 17:17:21 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-03-21 17:17:21 +0000
commitb7f6cc4e326cf6fad8bcb248dbfb6b4e633b41c2 (patch)
tree9eb2e28cde1dadf272a4721defe5a55549c623b5 /src/lib/Server/Snapshots
parent5aa449d28e421ea1c6b84caaf78512e195a4472c (diff)
downloadbcfg2-b7f6cc4e326cf6fad8bcb248dbfb6b4e633b41c2.tar.gz
bcfg2-b7f6cc4e326cf6fad8bcb248dbfb6b4e633b41c2.tar.bz2
bcfg2-b7f6cc4e326cf6fad8bcb248dbfb6b4e633b41c2.zip
Add revision and correct fields to snapshot class; should simplify most queries
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5133 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Snapshots')
-rw-r--r--src/lib/Server/Snapshots/model.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/Server/Snapshots/model.py b/src/lib/Server/Snapshots/model.py
index a913a25de..8209eeab7 100644
--- a/src/lib/Server/Snapshots/model.py
+++ b/src/lib/Server/Snapshots/model.py
@@ -200,6 +200,8 @@ action_snap = Table('action_snap', Base.metadata,
class Snapshot(Base):
__tablename__ = 'snapshot'
id = Column(Integer, primary_key=True)
+ correct = Column(Boolean)
+ revision = Column(Unicode(36))
metadata_id = Column(Integer, ForeignKey('metadata.id'))
client_metadata = relation(Metadata, primaryjoin=metadata_id==Metadata.id)
timestamp = Column(DateTime, default=datetime.datetime.now)
@@ -221,9 +223,10 @@ class Snapshot(Base):
('Path', ('extra_files', File))])
@classmethod
- def from_data(cls, session, metadata, entries, extra):
+ def from_data(cls, session, correct, revision, metadata, entries, extra):
dbm = Metadata.from_metadata(session, metadata)
- snap = cls(client_metadata=dbm, timestamp=datetime.datetime.now())
+ snap = cls(correct=correct, client_metadata=dbm, revision=revision,
+ timestamp=datetime.datetime.now())
for (dispatch, data) in [(cls.c_dispatch, entries),
(cls.e_dispatch, extra)]:
for key in dispatch: