summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-05-06 15:05:23 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-05-06 15:05:23 +0000
commitdb0cf063317ae488ed183713ef420312f7e01148 (patch)
tree11fe81f19c1892194c2b5d9d0c6c65db4c695f2c /src/lib/Server/Admin
parentbf8844ebd5fd7a1adda37652968808f12f08f3b8 (diff)
downloadbcfg2-db0cf063317ae488ed183713ef420312f7e01148.tar.gz
bcfg2-db0cf063317ae488ed183713ef420312f7e01148.tar.bz2
bcfg2-db0cf063317ae488ed183713ef420312f7e01148.zip
Snapshots: minor cosmetic updates
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5198 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin')
-rw-r--r--src/lib/Server/Admin/Snapshots.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/lib/Server/Admin/Snapshots.py b/src/lib/Server/Admin/Snapshots.py
index 2edc7f820..ab3fbc572 100644
--- a/src/lib/Server/Admin/Snapshots.py
+++ b/src/lib/Server/Admin/Snapshots.py
@@ -29,7 +29,7 @@ def print_table(rows, justify='left', hdr=True, vdelim=" ", padding=1):
calculate column widths (longest item in each column
plus padding on both sides)
'''
- cols = zip(*rows)
+ cols = list(zip(*rows))
colWidths = [max([len(str(item))+2*padding for \
item in col]) for col in cols]
borderline = vdelim.join([w*hdelim for w in colWidths])
@@ -38,7 +38,7 @@ def print_table(rows, justify='left', hdr=True, vdelim=" ", padding=1):
print(borderline)
for row in rows:
print(vdelim.join([justify(str(item), width) for \
- (item, width) in zip(row, colWidths)]))
+ (item, width) in zip(row, colWidths)]))
if hdr:
print(borderline)
hdr = False
@@ -78,7 +78,11 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
for host in \
self.session.query(q_obj).filter(q_obj.active == True):
rows.append([host.name, 'Yes'])
- print_table([labels]+rows, justify='left', hdr=True, vdelim=" ", padding=1)
+ print_table([labels]+rows,
+ justify='left',
+ hdr=True,
+ vdelim=" ",
+ padding=1)
elif q_obj == Group:
print("Groups:")
for group in self.session.query(q_obj).all():
@@ -86,8 +90,8 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
else:
results = self.session.query(q_obj).all()
else:
- print 'error'
- raise SystemExit, 1
+ print('error')
+ raise SystemExit(1)
elif args[0] == 'init':
# Initialize the Snapshots database
dbpath = Bcfg2.Server.Snapshots.db_from_config()
@@ -106,9 +110,9 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
sys.exit(1)
print("Client %s last run at %s" % (client, snap.timestamp))
for pkg in snap.packages:
- print "C:", pkg.correct, 'M:', pkg.modified
- print "start", pkg.start.name, pkg.start.version
- print "end", pkg.end.name, pkg.end.version
+ print("C:", pkg.correct, 'M:', pkg.modified)
+ print("start", pkg.start.name, pkg.start.version)
+ print("end", pkg.end.name, pkg.end.version)
elif args[0] == 'reports':
# bcfg2-admin reporting interface for Snapshots
if '-a' in args[1:]:
@@ -116,16 +120,20 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
q = self.session.query(Client.name,
Snapshot.correct,
Snapshot.revision,
- Snapshot.timestamp).filter(Client.id==Snapshot.client_id)\
+ Snapshot.timestamp)\
+ .filter(Client.id==Snapshot.client_id)\
.group_by(Client.id)
rows = []
labels = ('Client', 'Correct', 'Revision', 'Time')
for item in q.all():
cli, cor, time, rev = item
rows.append([cli, cor, time, rev])
- print_table([labels]+rows, justify='left', hdr=True, vdelim=" ", padding=1)
+ print_table([labels]+rows,
+ justify='left',
+ hdr=True, vdelim=" ",
+ padding=1)
elif '-b' in args[1:]:
- # Query a single host for extra entries
+ # Query a single host for bad entries
client = args[2]
snap = Snapshot.get_current(self.session, unicode(client))
if not snap:
@@ -139,7 +147,7 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
print(" Package:%s" % p)
bad_files = [self.session.query(File)
.filter(File.id==f.start_id).one().name \
- for f in snap.files if f.correct == False]
+ for f in snap.files if f.correct == False]
for filename in bad_files:
print(" File:%s" % filename)
bad_svcs = [self.session.query(Service)
@@ -163,4 +171,4 @@ class Snapshots(Bcfg2.Server.Admin.Mode):
for svc in snap.extra_services:
print(" Service:%s" % svc.name)
else:
- print "Unknown options: ", args[1:]
+ print("Unknown options: ", args[1:])