fix: Follow PDNS Api return format (#858)

This commit is contained in:
jbe-dw 2021-01-07 23:26:48 +01:00 committed by GitHub
parent 2c18e5c88f
commit 33e7ffb747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -903,7 +903,7 @@ def api_zone_forward(server_id, zone_id):
status = resp.status_code status = resp.status_code
if 200 <= status < 300: if 200 <= status < 300:
current_app.logger.debug("Request to powerdns API successful") current_app.logger.debug("Request to powerdns API successful")
if request.method != 'GET' and request.method != 'DELETE': if request.method == 'POST':
data = request.get_json(force=True) data = request.get_json(force=True)
for rrset_data in data['rrsets']: for rrset_data in data['rrsets']:
history = History(msg='{0} zone {1} record of {2}'.format( history = History(msg='{0} zone {1} record of {2}'.format(
@ -917,6 +917,11 @@ def api_zone_forward(server_id, zone_id):
detail='', detail='',
created_by=g.apikey.description) created_by=g.apikey.description)
history.add() history.add()
elif request.method != 'GET':
history = History(msg='Updated zone {0}'.format(zone_id),
detail='',
created_by=g.apikey.description)
history.add()
return resp.content, resp.status_code, resp.headers.items() return resp.content, resp.status_code, resp.headers.items()
@api_bp.route('/servers/<path:subpath>', methods=['GET', 'PUT']) @api_bp.route('/servers/<path:subpath>', methods=['GET', 'PUT'])