From 59cc645b9841ed30b94341473a7f128a05915298 Mon Sep 17 00:00:00 2001 From: Ruben van Staveren Date: Mon, 14 Mar 2022 15:22:26 +0100 Subject: [PATCH] code coverage shows the case is not hit. remove noop conditional --- jail2ban/auth.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/jail2ban/auth.py b/jail2ban/auth.py index 552c819..8b4b1b4 100644 --- a/jail2ban/auth.py +++ b/jail2ban/auth.py @@ -1,17 +1,15 @@ -from flask import current_app, g +from flask import current_app def get_users(): - if 'users' not in g: - users = {} - authfile = current_app.config['AUTHFILE'] + users = {} + authfile = current_app.config['AUTHFILE'] - current_app.logger.debug('Reading %s for users', authfile) + current_app.logger.debug('Reading %s for users', authfile) - with current_app.open_resource(authfile) as f: - for entry in f: - users.update({ - tuple(entry.decode('ascii').strip().split(':', 1))}) - g.users = users - current_app.logger.debug(g.users) - return g.users + with current_app.open_resource(authfile) as f: + for entry in f: + users.update({ + tuple(entry.decode('ascii').strip().split(':', 1))}) + current_app.logger.debug(users) + return users