new version of git-mirror uses fetch/merge and has a quite option for cron scripts.
[infrastructure.git] / scripts / manage-infrastructure.py
index bdd434e..f4fd9ad 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import os.path
+import os.path, sys
 import re
 import subprocess
 from optparse import OptionParser
@@ -8,13 +8,13 @@ from optparse import OptionParser
 class BuildBoxes:
 
     # everything in the onelab.eu domain
-    domain = 'onelab.eu'
+    domain = 'pl.sophia.inria.fr'
     testmaster = 'testmaster'
     build_boxes = [ "mirror", "liquid", "reed", "velvet", ]
     plc_boxes = [ "testplc" ]
     qemu_boxes = \
-        [ "testqemu%d"%i for i in range (1,4) ] + \
-        [ "testqemu32-%d"%i for i in range (1,6) ]
+        [ "qemu64-%d"%i for i in range (1,4) ] + \
+        [ "qemu32-%d"%i for i in range (1,6) ]
     test_boxes = plc_boxes + qemu_boxes
 
     def __init__ (self):
@@ -36,6 +36,7 @@ class BuildBoxes:
 
     def header (self,message):
         print "===============",message
+        sys.stdout.flush()
 
     def run (self,argv,message, trash_err=False):
         if self.options.dry_run:
@@ -62,7 +63,6 @@ class BuildBoxes:
             return subprocess.Popen(argv,stdout=subprocess.PIPE,stderr=file('/dev/null','w')).communicate()[0]
 
     def backquote_ssh (self, box, argv, trash_err=False):
-#        print 'BACKQUOTE_SSH [%s] %s'%(box,' '.join(argv))
         # first probe the ssh link
         hostname=self.backquote ( self.ssh(box) + [ "hostname"], trash_err=True )
         if not hostname:
@@ -220,6 +220,10 @@ class BuildBoxes:
         elif type=="build":
             self.handle_build_box(self.fqdn(box))
 
+    def handle_disk (self,box):
+        box=self.fqdn(box)
+        return self.run_ssh(box,["df","-h",],"Disk space on %s"%box)
+
     def main (self):
         usage="""%prog [options] [hostname..(s)]
 Default is to act on test boxes only (with trackers clean)"""
@@ -240,6 +244,8 @@ Default is to act on test boxes only (with trackers clean)"""
                            help="Only acts on the qemu boxes")
         parser.add_option ("-t","--trackers",action="store_true",dest="trackers_only",default=False,
                            help="Only wipes trackers")
+        parser.add_option ("-d","--disk",action="store_true",dest="show_disk",default=False,
+                           help="Only inspects disk status")
 
         (self.options,args) = parser.parse_args()
 
@@ -275,6 +281,10 @@ Default is to act on test boxes only (with trackers clean)"""
             self.do_tracker_plcs = True
             self.do_tracker_qemus = True
 
+        if self.options.show_disk:
+            for box in self.boxes: self.handle_disk(box)
+            return
+
         # ALL OTHERS
         for box in self.boxes:  self.handle_box (box,"build")
         # PLCS