From 889b676ee2bd92fced01a7e86fff86cae6fce9a5 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sun, 13 Jun 2010 12:53:17 +0200 Subject: [PATCH] -d is for inspecting disks --- scripts/manage-infrastructure.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/manage-infrastructure.py b/scripts/manage-infrastructure.py index c2e91f1..f4fd9ad 100755 --- a/scripts/manage-infrastructure.py +++ b/scripts/manage-infrastructure.py @@ -1,6 +1,6 @@ #!/usr/bin/python -import os.path +import os.path, sys import re import subprocess from optparse import OptionParser @@ -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 -- 2.47.0