Skip to content

Commit

Permalink
Do not shorten error message, when insert to DB fails
Browse files Browse the repository at this point in the history
  • Loading branch information
katkad committed Oct 20, 2015
1 parent f1842ba commit 8ef910e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions glastopf/modules/reporting/main/log_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def insert(self, attack_event):
conn = self.engine.connect()
conn.execute(self.events_table.insert(entry))
except exc.OperationalError as e:
message = str(e)[:35]
logger.error("Error inserting attack event into main database: {0}".format(message))
logger.error("Error inserting attack event into main database: {0}".format(e))

def insert_profile(self, ip_profile):
# print "last_event_time for ip %s:%s"%(
Expand All @@ -54,16 +53,14 @@ def insert_profile(self, ip_profile):
self.session.commit()
except exc.OperationalError as e:
self.session.rollback()
message = str(e)[:35]
logger.error("Error inserting profile into main database: {0}".format(message))
logger.error("Error inserting profile into main database: {0}".format(e))

def update_db(self):
try:
self.session.commit()
except exc.OperationalError as e:
self.session.rollback()
message = str(e)[:35]
logger.error("Error updating profile in main database: {0}".format(message))
logger.error("Error updating profile in main database: {0}".format(e))

def get_profile(self, source_ip):
ip_profile = self.session.query(ipp.IPProfile).filter(
Expand Down

0 comments on commit 8ef910e

Please sign in to comment.