sync users from PLC to RT db.
[monitor.git] / pcuinfo.py
index 20f9895..c9d1e90 100755 (executable)
@@ -2,18 +2,17 @@
 
 import database
 import plc
-from optparse import OptionParser
+import parser as parsermodule
 import sys
 from reboot import pcu_name, get_pcu_values
 
 import sys
-from config import config
 
 def print_dict(dict):
        for key in dict.keys():
                print "%30s : %s" % (key, dict[key])
 
-parser = OptionParser()
+parser = parsermodule.getParser()
 parser.set_defaults(withpcu=False,
                                        refresh=False)
 parser.add_option("-f", "--nodelist",dest="filename",default="", metavar="FILE",
@@ -21,9 +20,7 @@ parser.add_option("-f", "--nodelist",dest="filename",default="", metavar="FILE",
 parser.add_option("", "--refresh", action="store_true", dest="refresh",
                                        help="Refresh the cached values")
 
-
-config = config(parser)
-config.parse_args()
+config = parsermodule.parse_args(parser)
 
 if not config.run:
        k = config.__dict__.keys()
@@ -33,10 +30,10 @@ if not config.run:
        print "Add --run to actually perform the command"
        sys.exit(1)
 
-pculist = database.if_cached_else_refresh(1, 
-                                                       config.refresh, 
-                                                       "pculist", 
-                                                       lambda : plc.GetPCUs())
+pculist = plccache.l_pcus # database.if_cached_else_refresh(1, 
+                                                 #     config.refresh, 
+                                                 #     "pculist", 
+                                                 #     lambda : plc.GetPCUs())
 for pcu in pculist:
        #print pcu
        #sys.exit(1)