summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin/Snapshots.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-06-01 17:23:31 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-06-01 17:23:31 +0000
commit248f2efd8ac7c1d204542ab6bf77d386cc005508 (patch)
treefb9712350e448e6bd9aabc2ae146494f2b379481 /src/lib/Server/Admin/Snapshots.py
parenteb92d4866a208c12ab89fdc1d5dc50eaeee3dd32 (diff)
downloadbcfg2-248f2efd8ac7c1d204542ab6bf77d386cc005508.tar.gz
bcfg2-248f2efd8ac7c1d204542ab6bf77d386cc005508.tar.bz2
bcfg2-248f2efd8ac7c1d204542ab6bf77d386cc005508.zip
Snapshots: Add --date for detailed view for a particular date
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5266 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin/Snapshots.py')
-rw-r--r--src/lib/Server/Admin/Snapshots.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/Server/Admin/Snapshots.py b/src/lib/Server/Admin/Snapshots.py
index b2536acb1..cda8a3cd4 100644
--- a/src/lib/Server/Admin/Snapshots.py
+++ b/src/lib/Server/Admin/Snapshots.py
@@ -1,3 +1,4 @@
+from datetime import date
import sys
# prereq issues can be signaled with ImportError, so no try needed
@@ -134,5 +135,25 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
print(" File:%s" % f.name)
for svc in snap.extra_services:
print(" Service:%s" % svc.name)
+ elif '--date' in args[1:]:
+ year, month, day = args[2:]
+ timestamp = date(int(year), int(month), int(day))
+ snaps = []
+ for client in self.session.query(Client).filter(Client.active == True):
+ snaps.append(Snapshot.get_by_date(self.session,
+ client.name,
+ timestamp))
+ rows = []
+ labels = ('Client', 'Correct', 'Revision', 'Time')
+ for snap in snaps:
+ rows.append([snap.client.name,
+ snap.correct,
+ snap.revision,
+ snap.timestamp])
+ self.print_table([labels]+rows,
+ justify='left',
+ hdr=True,
+ vdelim=" ",
+ padding=1)
else:
print("Unknown options: ", args[1:])