mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-29 06:25:40 +00:00
Merge remote-tracking branch 'paepke/history-rrsets'
This commit is contained in:
commit
65d4acc6c5
@ -453,6 +453,27 @@ def api_zone_forward(server_id, zone_id):
|
||||
resp = helper.forward_request()
|
||||
domain = Domain()
|
||||
domain.update()
|
||||
status = resp.status_code
|
||||
if 200 <= status < 300:
|
||||
current_app.logger.debug("Request to powerdns API successful")
|
||||
if request.method != 'GET' and request.method != 'DELETE':
|
||||
data = request.get_json(force=True)
|
||||
for rrset_data in data['rrsets']:
|
||||
history = History(
|
||||
msg='{0} zone {1} record of {2}'.format(rrset_data['changetype'].lower(),
|
||||
rrset_data['type'],
|
||||
rrset_data['name'].rstrip('.')),
|
||||
detail=json.dumps(data),
|
||||
created_by=g.apikey.description
|
||||
)
|
||||
history.add()
|
||||
elif request.method == 'DELETE':
|
||||
history = History(
|
||||
msg='Deleted zone {0}'.format(domain.name),
|
||||
detail='',
|
||||
created_by=g.apikey.description
|
||||
)
|
||||
history.add()
|
||||
return resp.content, resp.status_code, resp.headers.items()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user