Allowed methods are listed in app.route, elif is noop here

This commit is contained in:
Ruben van Staveren 2022-03-11 22:04:48 +01:00
parent 542718b956
commit e3a71a851d
Signed by: ruben
GPG Key ID: 886F6BECD477A93F

View File

@ -77,7 +77,7 @@ def create_app():
]) ])
res = pfctl_cfg_write(f'f2b-jail/{remote_user}', res = pfctl_cfg_write(f'f2b-jail/{remote_user}',
b'\n'.join(cfg) + b'\n') b'\n'.join(cfg) + b'\n')
elif request.method == 'DELETE': else: # 'DELETE':
cfg = [cfg_line for cfg_line in cfg cfg = [cfg_line for cfg_line in cfg
if cfg_line.find(bytes(f'<f2b-{name}>', 'ascii')) == -1] if cfg_line.find(bytes(f'<f2b-{name}>', 'ascii')) == -1]
res = pfctl_cfg_write(f'f2b-jail/{remote_user}', res = pfctl_cfg_write(f'f2b-jail/{remote_user}',
@ -110,7 +110,7 @@ def create_app():
table=f'f2b-{name}', table=f'f2b-{name}',
operation='add', operation='add',
value=str(ip)) value=str(ip))
elif request.method == 'DELETE': else: # 'DELETE':
app.logger.info(f'Remove {ip} from f2b-{name}' app.logger.info(f'Remove {ip} from f2b-{name}'
f' in anchor f2b-jail/{remote_user}') f' in anchor f2b-jail/{remote_user}')
res = pfctl_table_op(f'f2b-jail/{remote_user}', res = pfctl_table_op(f'f2b-jail/{remote_user}',