rename to default value.
[monitor.git] / syncplcdb.py
index d83e8d3..de6a474 100755 (executable)
@@ -1,12 +1,10 @@
 #!/usr/bin/python
 
 import plc
-from config import config
-import soltesz
+import config
+import database
 import sys
 
-config = config()
-
 def dsites_from_lsites(l_sites):
        d_sites = {}
        id2lb = {}
@@ -28,6 +26,9 @@ def dsn_from_dsln(d_sites, id2lb, l_nodes):
                if node['site_id'] in id2lb.keys():
                        login_base = id2lb[node['site_id']]
                else:
+                       print "%s has a foreign site_id %s" % (node['hostname'], 
+                                                                                                       node['site_id'])
+                       continue
                        for i in id2lb:
                                print i, " ", id2lb[i]
                        raise Exception, "Node has missing site id!! %s %d" %(node['hostname'], node['site_id'])
@@ -85,12 +86,12 @@ def create_plcdb():
 
        if ('cachenodes' in dir(config) and config.cachenodes) or \
                'cachenodes' not in dir(config):
-               soltesz.dbDump("plcdb_hn2lb", hn2lb)
-               soltesz.dbDump("plcdb_lb2hn", lb2hn)
-               soltesz.dbDump("plcdb_netid2ip", netid2ip)
-               soltesz.dbDump("l_plcnodenetworks", l_nodenetworks)
-               soltesz.dbDump("l_plcnodes", l_nodes)
-               soltesz.dbDump("l_plcsites", l_sites)
+               database.dbDump("plcdb_hn2lb", hn2lb)
+               database.dbDump("plcdb_lb2hn", lb2hn)
+               database.dbDump("plcdb_netid2ip", netid2ip)
+               database.dbDump("l_plcnodenetworks", l_nodenetworks)
+               database.dbDump("l_plcnodes", l_nodes)
+               database.dbDump("l_plcsites", l_sites)
        
        return l_nodes