From 6cc1ea70c74f14a8147bf0ca952ab18443358a08 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Fri, 23 Sep 2022 23:21:13 +0200 Subject: [PATCH] Writing information to database now at a fritzconnection exception. --- bin/uplink | 2 +- uplink/uplink.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/uplink b/bin/uplink index 0015f5b..fdb0347 100755 --- a/bin/uplink +++ b/bin/uplink @@ -51,7 +51,7 @@ MINOR changes are "just-in-time" changes or small enhancements which should not documentation. FIXES should never affect anything else then stability or security. """ -__version__ = '0.9.1.1' +__version__ = '0.9.2' __author__ = 'Johannes Findeisen ' logger = logging.getLogger('uplink') diff --git a/uplink/uplink.py b/uplink/uplink.py index 0b3a737..7108797 100644 --- a/uplink/uplink.py +++ b/uplink/uplink.py @@ -157,6 +157,19 @@ class Uplink(Daemon): except Exception as err: message = str('error when getting data from ' + uplink['ip'] + '') + + model = Model(self.__configuration) + model.set_date(date_formatted) + model.set_internal_ip(uplink['ip']) + model.set_message('FATAL: ' + str(message.format(err))) + model.set_provider(uplink['provider']) + model.set_source_host(socket.gethostname()) + model.set_time(time_formatted) + model.set_timestamp(timestamp) + + database = Database(self.__configuration) + database.write_log_to_db(model) + logger.error(str(message.format(err))) def run(self):