display only active leases unless verbose
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 25 Jun 2010 15:10:28 +0000 (17:10 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 25 Jun 2010 15:10:28 +0000 (17:10 +0200)
system/TestPlc.py

index 86826dd..1236395 100644 (file)
@@ -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