Development
This commit is contained in:
parent
59ac3c5973
commit
3d0dc265ba
31 changed files with 1093 additions and 2794 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import os
|
||||
from view_common import CONFIGS_DIR
|
||||
from config_utils import collect_layout_tokens, CONFIGS_DIR
|
||||
|
||||
RADIUS_LOG_MAX = 50
|
||||
RADIUS_LOG_FILE = '/var/log/freeradius/radius.log'
|
||||
|
||||
|
||||
def _radius_log_tail(cfg):
|
||||
def radius_log_tail(cfg):
|
||||
try:
|
||||
log_max_kb = cfg.get('radius', {}).get('general', {}).get('log_max_kb', 1024)
|
||||
size_kb = os.path.getsize(RADIUS_LOG_FILE) / 1024
|
||||
|
|
@ -32,7 +32,7 @@ def _radius_log_tail(cfg):
|
|||
|
||||
|
||||
def collect_tokens(cfg):
|
||||
tokens = {}
|
||||
tokens = collect_layout_tokens(cfg)
|
||||
try:
|
||||
tokens['RADIUS_SECRET'] = open(f'{CONFIGS_DIR}/.radius-secret').read().strip()
|
||||
except OSError:
|
||||
|
|
@ -44,5 +44,5 @@ def collect_tokens(cfg):
|
|||
tokens['RADIUS_APPLY_TO'] = fr_opts.get('apply_to', 'all')
|
||||
tokens['RADIUS_LOGGING'] = 'true' if fr_gen.get('logging', False) else ''
|
||||
tokens['RADIUS_GEN_LOG_MAX_KB'] = str(fr_gen.get('log_max_kb', 1024))
|
||||
tokens['RADIUS_LOG_TAIL'], tokens['RADIUS_LOG_SUMMARY'] = _radius_log_tail(cfg)
|
||||
tokens['RADIUS_LOG_TAIL'], tokens['RADIUS_LOG_SUMMARY'] = radius_log_tail(cfg)
|
||||
return tokens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue