fix tracker probing
authorthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Mon, 25 Jan 2010 11:00:57 +0000 (11:00 +0000)
committerthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Mon, 25 Jan 2010 11:00:57 +0000 (11:00 +0000)
scripts/manage-infrastructure.py

index 267510e..84ad9c1 100755 (executable)
@@ -27,12 +27,15 @@ class BuildBoxes:
     @staticmethod
     def root (box): return "root@%s"%box
 
+    def header (self,message):
+        print "===============",message
+
     def run (self,argv,message):
         if self.options.dry_run:
             print 'DRY_RUN:',
             print " ".join(argv)
         else:
-            if message: print "===============",message
+            if message: self.header(message)
             subprocess.call(argv)
                 
     def backquote (self, argv):
@@ -45,11 +48,11 @@ class BuildBoxes:
     def handle_trackers (self):
         box = self.fqdn (self.testmaster)
         if self.options.probe:
-            command=['ssh',self.root(box),"head","-100","'trackers*'"]
-            self.run(command,"========== Inspecting trackers on %s"%box)
+            command=['ssh',self.root(box),"head","-100","tracker*"]
+            self.run(command,"Inspecting trackers on %s"%box)
         else:
-            command=['ssh',self.root(box),"rm","-rf","'trackers*'"]
-            self.run(command,"========== Cleaning up trackers on %s"%box)
+            command=['ssh',self.root(box),"rm","-rf","tracker*"]
+            self.run(command,"Cleaning up trackers on %s"%box)
 
     def handle_build_box (self,box):
         if self.options.probe:
@@ -59,7 +62,7 @@ class BuildBoxes:
             else:
                 pids=self.backquote(command)
                 if not pids:
-                    print 'No build process on',box
+                    self.header ('No build process on %s'%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)
@@ -81,7 +84,7 @@ class BuildBoxes:
             else:
                 pids=self.backquote(command)
                 if not pids:
-                    print 'No qemu process on',box
+                    self.header ('No qemu process on %s'%box)
                 else:
                     command=['ssh',self.root(box),'ps'] + [ pid for pid in pids.split("\n") if pid]
                     self.run(command,"Active qemu processes on %s"%box)