X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=DominoServer.py;h=05f1ab23496e09929d8018752e80af77050c4b13;hb=311f19da59300957f82c6ecbe3b4904ef50e5b66;hp=f2a22e28a3a146fffec3cb4931a933030f68215f;hpb=28f34e2ae729c0e40874ebfc2e60f3854d95f724;p=domino.git diff --git a/DominoServer.py b/DominoServer.py index f2a22e2..05f1ab2 100755 --- a/DominoServer.py +++ b/DominoServer.py @@ -198,6 +198,17 @@ class CommunicationHandler: logging.error('Could not add the new labels to %s for Domino Client %d', SERVER_DBFILE, sub_msg.domino_udid) logging.error('Unexpected error: %s', sys.exc_info()[0]) + newttypeset = self.dominoServer.subscribed_templateformats[sub_msg.domino_udid] + try: + c.execute("REPLACE INTO ttypes (udid, ttype_list) VALUES ({udid}, '{newvalue}')".\ + format(udid=sub_msg.domino_udid, newvalue=','.join(list(newttypeset)) )) + except sqlite3.OperationalError as ex1: + logging.error('Could not add the new labels to %s for Domino Client %d : %s', SERVER_DBFILE, sub_msg.domino_udid, ex1.message) + except: + logging.error('Could not add the new labels to %s for Domino Client %d', SERVER_DBFILE, sub_msg.domino_udid) + logging.error('Unexpected error: %s', sys.exc_info()[0]) + + dbconn.commit() dbconn.close() @@ -328,7 +339,7 @@ class DominoServer: def main(argv): server = DominoServer() - loglevel = 'WARNING' + loglevel = LOGLEVEL #process input arguments try: opts, args = getopt.getopt(argv,"hc:l:",["conf=","log="]) @@ -361,6 +372,11 @@ def main(argv): except sqlite3.OperationalError as ex: logging.debug('In database file %s, no table is created as %s', SERVER_DBFILE, ex.message) + try: + c.execute('''CREATE TABLE ttypes (udid INTEGER PRIMARY KEY, ttype_list TEXT)''') + except sqlite3.OperationalError as ex: + logging.debug('In database file %s, no table is created as %s', SERVER_DBFILE, ex.message) + try: c.execute('''CREATE TABLE clients (udid INTEGER PRIMARY KEY, ipaddr TEXT, tcpport INTEGER, templatetypes TEXT, seqno INTEGER)''') except sqlite3.OperationalError as ex: