5 import parser as parsermodule
7 from reboot import pcu_name, get_pcu_values
12 for key in dict.keys():
13 print "%30s : %s" % (key, dict[key])
15 parser = parsermodule.getParser()
16 parser.set_defaults(withpcu=False,
18 parser.add_option("-f", "--nodelist",dest="filename",default="", metavar="FILE",
19 help="Provide the input file for the downnode list")
20 parser.add_option("", "--refresh", action="store_true", dest="refresh",
21 help="Refresh the cached values")
23 config = parsermodule.parse_args(parser)
26 k = config.__dict__.keys()
29 print o, "=", config.__dict__[o]
30 print "Add --run to actually perform the command"
33 pculist = plccache.l_pcus # database.if_cached_else_refresh(1,
36 # lambda : plc.GetPCUs())
40 if pcu['model'] == None:
43 if True: # pcu['model'].find("APC AP79xx/Masterswitch") >= 0:
45 values = get_pcu_values(pcu['pcu_id'])
46 if 'portstatus' not in values:
49 if values['reboot'] == 0 or (not isinstance(values['reboot'],int) and values['reboot'].find("error") >= 0):
50 portstatus = "22:%(22)s 23:%(23)s" % values['portstatus']
51 if values['reboot'] == 0:
52 print "%6d %20s %50s %s" % (pcu['pcu_id'], pcu['password'], "%s@%s" % (pcu['username'], host), portstatus)
54 #database.dbDump("pculist", pculist, 'php')