mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-26 13:05:40 +00:00
Patch API record update/delete logging to match current logging format
This commit is contained in:
parent
c5b9e24604
commit
02700ee7b0
@ -1119,14 +1119,16 @@ def api_zone_forward(server_id, zone_id):
|
|||||||
if Setting().get('enable_api_rr_history'):
|
if Setting().get('enable_api_rr_history'):
|
||||||
if request.method in ['POST', 'PATCH']:
|
if request.method in ['POST', 'PATCH']:
|
||||||
data = request.get_json(force=True)
|
data = request.get_json(force=True)
|
||||||
for rrset_data in data['rrsets']:
|
history = History(
|
||||||
history = History(msg='{0} zone {1} record of {2}'.format(
|
msg='Apply record changes to domain {0}'.format(zone_id.rstrip('.')),
|
||||||
rrset_data['changetype'].lower(), rrset_data['type'],
|
detail = json.dumps({
|
||||||
rrset_data['name'].rstrip('.')),
|
'domain': zone_id.rstrip('.'),
|
||||||
detail=json.dumps(data),
|
'add_rrsets': list(filter(lambda r: r['changetype'] == "REPLACE", data['rrsets'])),
|
||||||
created_by=g.apikey.description,
|
'del_rrsets': list(filter(lambda r: r['changetype'] == "DELETE", data['rrsets']))
|
||||||
domain_id=Domain().get_id_by_name(zone_id.rstrip('.')))
|
}),
|
||||||
history.add()
|
created_by=g.apikey.description,
|
||||||
|
domain_id=Domain().get_id_by_name(zone_id.rstrip('.')))
|
||||||
|
history.add()
|
||||||
elif request.method == 'DELETE':
|
elif request.method == 'DELETE':
|
||||||
history = History(msg='Deleted zone {0}'.format(zone_id.rstrip('.')),
|
history = History(msg='Deleted zone {0}'.format(zone_id.rstrip('.')),
|
||||||
detail='',
|
detail='',
|
||||||
|
Loading…
Reference in New Issue
Block a user