improve build listing
authorthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Mon, 25 Jan 2010 10:47:08 +0000 (10:47 +0000)
committerthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Mon, 25 Jan 2010 10:47:08 +0000 (10:47 +0000)
scripts/manage-infrastructure.py

index cb34056..267510e 100755 (executable)
@@ -54,7 +54,15 @@ class BuildBoxes:
     def handle_build_box (self,box):
         if self.options.probe:
             command=['ssh',self.root(box),'pgrep','build']
-            self.run(command,"Listing build processes on %s"%box)
+            if self.options.dry_run:
+                self.run(command,None)
+            else:
+                pids=self.backquote(command)
+                if not pids:
+                    print 'No build process on',box
+                else:
+                    command=['ssh',self.root(box),'ps'] + [ pid for pid in pids.split("\n") if pid]
+                    self.run(command,"Active build processes on %s"%box)
         else:
             self.reboot(box)