-
-
Save lonnen/1126528 to your computer and use it in GitHub Desktop.
newtcbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import logging | |
from datetime import datetime | |
from datetime import timedelta | |
logger = logging.getLogger("duplicates") | |
import socorro.lib.psycopghelper as psy | |
import socorro.lib.util as util | |
def update(config): | |
databaseConnectionPool = psy.DatabaseConnectionPool(config.databaseHost, config.databaseName, config.databaseUserName, config.databasePassword, logger) | |
sql = { | |
'update_product_versions' : """SELECT update_product_versions()""", | |
'update_signatures' : """SELECT update_signatures()""", | |
'update_os_versions' : """SELECT update_os_versions()""", | |
'update_tcbs' : """SELECT update_tcbs()""", | |
'update_adu' : """SELECT update_adu()""", | |
} | |
deps = { 'update_tcbs': ['update_product_versions', 'update_signatures'] } | |
for f in sql.keys(): | |
try: | |
print f | |
connection, cursor= databaseConnectionPool.connectionCursorPair() | |
cursor.execute(sql[f]]) | |
connection.commit() | |
except: | |
if f in deps: | |
print "%s failed, not running %s" % (f, deps[f]) | |
print functions | |
for d in deps[f]: | |
functions.remove(d) | |
print functions | |
finally: | |
databaseConnectionPool.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment