-def get_filefromglob(d, str):
- import os
- import glob
- # TODO: This is aweful.
- path = "archive-pdb"
- archive = soltesz.SPickle(path)
- glob_str = "%s*.%s.pkl" % (d.strftime("%Y-%m-%d"), str)
- os.chdir(path)
- #print glob_str
- file = glob.glob(glob_str)[0]
- #print "loading %s" % file
- os.chdir("..")
- return file[:-4]
- #fb = archive.load(file[:-4])
-
-
-while True:
- file = get_filefromglob(d, "production.findbad")
- #file = "%s.production.findbad" % d.strftime("%Y-%m-%d")
-
- try:
- fb = archive.load(file)
- if config.node in fb['nodes']:
- fb_nodeinfo = fb['nodes'][config.node]['values']
- fb_print_nodeinfo(fb_nodeinfo, verbose, d.strftime("%Y-%m-%d"))
-
- del fb
- verbose = 0
- except KeyboardInterrupt:
+ if config.node is None and len(config.args) > 0:
+ config.node = config.args[0]
+ elif config.node is None:
+ print "Add a hostname to arguments"
+ print "exit."