From 108104742efb8a11d781fdf5cbf0712383ab734b Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 25 Jun 2010 17:10:28 +0200 Subject: [PATCH] display only active leases unless verbose --- system/TestPlc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/system/TestPlc.py b/system/TestPlc.py index 86826dd..1236395 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -713,10 +713,13 @@ class TestPlc: def list_leases (self): "list all leases known to the myplc" leases = self.apiserver.GetLeases(self.auth_root()) + now=int(time.time()) for l in leases: - utils.header("%s %s from %s until %s"%(l['hostname'],l['name'], - TestPlc.timestamp_printable(l['t_from']), - TestPlc.timestamp_printable(l['t_until']))) + current=l['t_until']>=now + if self.options.verbose or current: + utils.header("%s %s from %s until %s"%(l['hostname'],l['name'], + TestPlc.timestamp_printable(l['t_from']), + TestPlc.timestamp_printable(l['t_until']))) return True # create nodegroups if needed, and populate -- 2.47.0