better lemur integration
This commit is contained in:
parent
94b6563d8f
commit
ef43b197a1
@ -65,6 +65,18 @@ if 'CELERYRISOTTO_DB_USER' in environ:
|
||||
CELERYRISOTTO_DB_USER = environ['CELERYRISOTTO_DB_USER']
|
||||
else:
|
||||
CELERYRISOTTO_DB_USER = config.get('CELERYRISOTTO_DB_USER', None)
|
||||
if 'LEMUR_DB_NAME' in environ:
|
||||
LEMUR_DB_NAME = environ['LEMUR_DB_NAME']
|
||||
else:
|
||||
LEMUR_DB_NAME = config.get('LEMUR_DB_NAME', None)
|
||||
if 'LEMUR_DB_PASSWORD' in environ:
|
||||
LEMUR_DB_PASSWORD = environ['LEMUR_DB_PASSWORD']
|
||||
else:
|
||||
LEMUR_DB_PASSWORD = config.get('LEMUR_DB_PASSWORD', None)
|
||||
if 'LEMUR_DB_USER' in environ:
|
||||
LEMUR_DB_USER = environ['LEMUR_DB_USER']
|
||||
else:
|
||||
LEMUR_DB_USER = config.get('LEMUR_DB_USER', None)
|
||||
if 'DB_ADDRESS' in environ:
|
||||
DB_ADDRESS = environ['DB_ADDRESS']
|
||||
else:
|
||||
@ -141,7 +153,8 @@ def dsn_factory(database, user, password, address=DB_ADDRESS):
|
||||
|
||||
_config = {'database': {'dsn': dsn_factory(RISOTTO_DB_NAME, RISOTTO_DB_USER, RISOTTO_DB_PASSWORD),
|
||||
'tiramisu_dsn': dsn_factory(TIRAMISU_DB_NAME, TIRAMISU_DB_USER, TIRAMISU_DB_PASSWORD),
|
||||
'celery_dsn': dsn_factory(CELERYRISOTTO_DB_NAME, CELERYRISOTTO_DB_USER, CELERYRISOTTO_DB_PASSWORD)
|
||||
'celery_dsn': dsn_factory(CELERYRISOTTO_DB_NAME, CELERYRISOTTO_DB_USER, CELERYRISOTTO_DB_PASSWORD),
|
||||
'lemur_dns': dsn_factory(LEMUR_DB_NAME, LEMUR_DB_USER, LEMUR_DB_PASSWORD),
|
||||
},
|
||||
'http_server': {'port': RISOTTO_PORT,
|
||||
'default_user': DEFAULT_USER,
|
||||
|
@ -475,6 +475,8 @@ class Dispatcher(register.RegisterDispatcher,
|
||||
)
|
||||
# notification
|
||||
if function_obj.get('notification'):
|
||||
if returns is None:
|
||||
raise Exception(_(f'function "{function_obj["full_module_name"]}.{function_obj["function"].__name__}" must returns something for {function_obj["notification"]}!'))
|
||||
notif_version, notif_message = function_obj['notification'].split('.', 1)
|
||||
if not isinstance(returns, list):
|
||||
send_returns = [returns]
|
||||
|
@ -23,9 +23,13 @@ extra_statics = {}
|
||||
|
||||
def create_context(request):
|
||||
risotto_context = Context()
|
||||
risotto_context.username = request.match_info.get('username',
|
||||
get_config()['http_server']['default_user'],
|
||||
)
|
||||
if 'username' in dict(request.match_info):
|
||||
username = request.match_info['username']
|
||||
elif 'username' in request.headers:
|
||||
username = request.headers['username']
|
||||
else:
|
||||
username = get_config()['http_server']['default_user']
|
||||
risotto_context.username = username
|
||||
return risotto_context
|
||||
|
||||
|
||||
|
@ -192,7 +192,7 @@ class Logger:
|
||||
await connection.execute(sql,
|
||||
risotto_context.start_id,
|
||||
datetime.now(),
|
||||
err,
|
||||
err[:254],
|
||||
LEVELS.index('Failure'),
|
||||
)
|
||||
|
||||
|
@ -107,6 +107,7 @@ class RegisterDispatcher:
|
||||
version = obj['version']
|
||||
if version not in self.messages:
|
||||
self.messages[version] = {}
|
||||
obj['message'] = tiramisu_message
|
||||
self.messages[version][tiramisu_message] = obj
|
||||
|
||||
def get_function_args(self,
|
||||
|
Loading…
Reference in New Issue
Block a user