Added version to env vars, added local hostname to env vars and a bug fix.
This commit is contained in:
parent
b114befaff
commit
2dbc971275
3 changed files with 9 additions and 3 deletions
|
|
@ -31,6 +31,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import os
|
import os
|
||||||
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
@ -47,7 +48,7 @@ MINOR changes are "just-in-time" changes or small enhancements which should not
|
||||||
documentation.
|
documentation.
|
||||||
FIXES should never affect anything else then stability or security.
|
FIXES should never affect anything else then stability or security.
|
||||||
"""
|
"""
|
||||||
__version__ = '0.8.3.2'
|
__version__ = '0.8.4.0'
|
||||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||||
|
|
||||||
logger = logging.getLogger('uplink')
|
logger = logging.getLogger('uplink')
|
||||||
|
|
@ -107,6 +108,10 @@ def main():
|
||||||
logger.error(str('[uplink] configuration error: {0}'.format(err)))
|
logger.error(str('[uplink] configuration error: {0}'.format(err)))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
configuration.set_env_var('_hostname', socket.gethostname())
|
||||||
|
|
||||||
|
configuration.set_env_var('__version__', __version__)
|
||||||
|
|
||||||
configuration.set_env_var('_internal_start_date', time.strftime('%Y-%m-%d %H:%M:%S',
|
configuration.set_env_var('_internal_start_date', time.strftime('%Y-%m-%d %H:%M:%S',
|
||||||
time.localtime(calendar.timegm(time.gmtime()))))
|
time.localtime(calendar.timegm(time.gmtime()))))
|
||||||
configuration.set_env_var('_internal_start_timestamp', calendar.timegm(time.gmtime()))
|
configuration.set_env_var('_internal_start_timestamp', calendar.timegm(time.gmtime()))
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ class HTTPServer:
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def config(self):
|
def config(self):
|
||||||
return '<!DOCTYPE html><html><head><title>[uplink] configuration</title><meta ' + \
|
return '<!DOCTYPE html><html><head><title>[uplink@' + \
|
||||||
|
self.__configuration.get_env_var("_hostname") + '] configuration</title><meta ' + \
|
||||||
'http-equiv="refresh" content="60"></head><body><pre ' + \
|
'http-equiv="refresh" content="60"></head><body><pre ' + \
|
||||||
'style="border:2px solid black;background:#1d2021;color:#f0751a;">' + \
|
'style="border:2px solid black;background:#1d2021;color:#f0751a;">' + \
|
||||||
json.dumps(vars(self.__configuration), sort_keys=True, indent=4) + \
|
json.dumps(vars(self.__configuration), sort_keys=True, indent=4) + \
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ class Uplink(Daemon):
|
||||||
if fail_count == 1 or fail_count % notification_gammu_repeat == 0:
|
if fail_count == 1 or fail_count % notification_gammu_repeat == 0:
|
||||||
from uplink.notification import Notification
|
from uplink.notification import Notification
|
||||||
notification = Notification(self.__configuration)
|
notification = Notification(self.__configuration)
|
||||||
notification.send('[' + uplink['provider'] + '] ' + status)
|
notification.send('[' + uplink['identifier'] + '] ' + status)
|
||||||
|
|
||||||
logger.info(str(uplink['identifier'] + ': ' + status))
|
logger.info(str(uplink['identifier'] + ': ' + status))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue