Commit 7fec7431 authored by Zenon Mousmoulas's avatar Zenon Mousmoulas

Amendment for e0adfeb0 (servdata consumer templates adjustment for the

"server re-use across institutions" use case): avoid hard-coding
Operator-Name (and F-Ticks VISINST) by tracking "usecount" for radius
clients
parent 3a60a4c0
......@@ -2,6 +2,15 @@
<%!
import re
%>\
<%
for inst in insts:
if inst['type'] in (2, 3) and 'clients' in inst:
for client in inst['clients']:
if 'usecount' in clients[client]:
clients[client]['usecount'] = clients[client]['usecount'] + 1
else:
clients[client]['usecount'] = 1
%>\
% for inst in insts:
% if inst['type'] in (2, 3) and 'clients' in inst:
#{{{${' ' + inst['id'] if 'id' in inst else ''}
......@@ -19,7 +28,7 @@ ipaddr = re.split(r'/(?=[0-9]{1,2}$)', clients[client]['host'])
netmask = ${ipaddr[1]}
% endif
nastype = other
% if 'id' in inst:
% if clients[client]['usecount'] == 1 and 'id' in inst:
grnetopname = 1${inst['id']}
% endif
eduroamspco = GR
......
......@@ -18,6 +18,15 @@ def wildcard_realm_least_precedence(a, b):
else:
return 0
%>\
<%
for inst in insts:
if inst['type'] in (2, 3) and 'clients' in inst:
for client in inst['clients']:
if 'usecount' in clients[client]:
clients[client]['usecount'] = clients[client]['usecount'] + 1
else:
clients[client]['usecount'] = 1
%>\
% for inst in insts:
% if True in [c in inst for c in ['clients', 'realms']]:
#{{{${' ' + inst['id'] if 'id' in inst else ''}
......@@ -28,7 +37,7 @@ def wildcard_realm_least_precedence(a, b):
% else:
rewrite rewrite-${client}-sp {
include /etc/radsecproxy.conf.d/rewrite-default-sp.conf
% if 'id' in inst:
% if clients[client]['usecount'] == 1 and 'id' in inst:
addAttribute 126:1${inst['id']}
% endif
}
......@@ -38,7 +47,7 @@ client ${client} {
type udp
secret ${clients[client]['secret'] | percent_escape}
fticksVISCOUNTRY GR
% if 'id' in inst:
% if clients[client]['usecount'] == 1 and 'id' in inst:
fticksVISINST 1${inst['id']}
% endif
rewriteIn rewrite-${client}-sp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment