import time
-import soltesz
+import database
import comon
import threadpool
import syncplcdb
from nodequery import verify,query_to_dict,node_select
import plc
-import auth
-api = plc.PLC(auth.auth, auth.plc)
+api = plc.getAuthAPI()
from unified_model import *
-from monitor_policy import MINUP
+from const import MINUP
round = 1
externalState = {'round': round, 'sites': {}}
def main(config):
global externalState
- externalState = soltesz.if_cached_else(1, config.dbname, lambda : externalState)
+ externalState = database.if_cached_else(1, config.dbname, lambda : externalState)
if config.increment:
# update global round number to force refreshes across all nodes
externalState['round'] += 1
l_nodes = syncplcdb.create_plcdb()
- l_plcsites = soltesz.dbLoad("l_plcsites")
+ l_plcsites = database.dbLoad("l_plcsites")
if config.site:
l_sites = [config.site]
count += 1
if count % 20 == 0:
- soltesz.dbDump(config.dbname, externalState)
+ database.dbDump(config.dbname, externalState)
- soltesz.dbDump(config.dbname, externalState)
+ database.dbDump(config.dbname, externalState)
-fb = soltesz.dbLoad('findbad')
-lb2hn = soltesz.dbLoad("plcdb_lb2hn")
+fb = database.dbLoad('findbad')
+lb2hn = database.dbLoad("plcdb_lb2hn")
def getnodesup(nodelist):
up = 0
return True
if __name__ == '__main__':
- from config import config
- from optparse import OptionParser
- parser = OptionParser()
+ import parser as parsermodule
+
+ parser = parsermodule.getParser()
parser.set_defaults(filename=None, node=None, site=None, nodeselect=False, nodegroup=None,
increment=False, dbname="sitebad", cachenodes=False)
parser.add_option("", "--site", dest="site", metavar="login_base",
help="Specify the name of the database to which the information is saved")
parser.add_option("-i", "--increment", action="store_true", dest="increment",
help="Increment round number to force refresh or retry")
- config = config(parser)
- config.parse_args()
+ config = parsermodule.parse_args(parser)
try:
main(config)
print traceback.print_exc()
print "Exception: %s" % err
print "Saving data... exitting."
- soltesz.dbDump(config.dbname, externalState)
+ database.dbDump(config.dbname, externalState)
sys.exit(0)