mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 19:05:39 +00:00
Merge pull request #60 from CaptainQwark/master
fix for pdns 4.0.0-rc2+ apply changes problems
This commit is contained in:
commit
1b052f7fc0
@ -64,6 +64,9 @@ def fetch_json(remote_url, method='GET', data=None, params=None, headers=None):
|
|||||||
if method == "DELETE":
|
if method == "DELETE":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if r.status_code == 204:
|
||||||
|
return {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
assert('json' in r.headers['content-type'])
|
assert('json' in r.headers['content-type'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -10,7 +10,7 @@ import onetimepass
|
|||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
from flask.ext.login import AnonymousUserMixin
|
from flask_login import AnonymousUserMixin
|
||||||
|
|
||||||
from app import app, db
|
from app import app, db
|
||||||
from lib import utils
|
from lib import utils
|
||||||
@ -720,7 +720,7 @@ class Record(object):
|
|||||||
if check:
|
if check:
|
||||||
r = check[0]
|
r = check[0]
|
||||||
if r['type'] in ('A', 'AAAA' ,'CNAME'):
|
if r['type'] in ('A', 'AAAA' ,'CNAME'):
|
||||||
return {'status': 'error', 'msg': 'Record might was already exist with type "A", "AAAA", "CNAME"'}
|
return {'status': 'error', 'msg': 'Record already exists with type "A", "AAAA" or "CNAME"'}
|
||||||
|
|
||||||
# continue if the record is ready to be added
|
# continue if the record is ready to be added
|
||||||
headers = {}
|
headers = {}
|
||||||
@ -896,10 +896,10 @@ class Record(object):
|
|||||||
headers = {}
|
headers = {}
|
||||||
headers['X-API-Key'] = PDNS_API_KEY
|
headers['X-API-Key'] = PDNS_API_KEY
|
||||||
jdata1 = utils.fetch_json(urlparse.urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones/%s' % domain), headers=headers, method='PATCH', data=postdata_for_delete)
|
jdata1 = utils.fetch_json(urlparse.urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones/%s' % domain), headers=headers, method='PATCH', data=postdata_for_delete)
|
||||||
logging.debug('jdata1: ', jdata1)
|
# logging.debug('jdata1: ', jdata1)
|
||||||
|
|
||||||
jdata2 = utils.fetch_json(urlparse.urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones/%s' % domain), headers=headers, method='PATCH', data=postdata_for_new)
|
jdata2 = utils.fetch_json(urlparse.urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones/%s' % domain), headers=headers, method='PATCH', data=postdata_for_new)
|
||||||
logging.debug('jdata2: ', jdata2)
|
# logging.debug('jdata2: ', jdata2)
|
||||||
|
|
||||||
if 'error' in jdata2.keys():
|
if 'error' in jdata2.keys():
|
||||||
logging.error('Cannot apply record changes.')
|
logging.error('Cannot apply record changes.')
|
||||||
@ -1174,4 +1174,4 @@ class Setting(db.Model):
|
|||||||
logging.error('Cannot edit setting %s' % setting)
|
logging.error('Cannot edit setting %s' % setting)
|
||||||
logging.debug(traceback.format_exec())
|
logging.debug(traceback.format_exec())
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
return False
|
return False
|
||||||
|
@ -6,7 +6,7 @@ import pyqrcode
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from flask.ext.login import login_user, logout_user, current_user, login_required
|
from flask_login import login_user, logout_user, current_user, login_required
|
||||||
from flask import Flask, g, request, make_response, jsonify, render_template, session, redirect, url_for, send_from_directory
|
from flask import Flask, g, request, make_response, jsonify, render_template, session, redirect, url_for, send_from_directory
|
||||||
from werkzeug import secure_filename
|
from werkzeug import secure_filename
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ def dashboard():
|
|||||||
domain_count = Domain.query.count()
|
domain_count = Domain.query.count()
|
||||||
users = User.query.all()
|
users = User.query.all()
|
||||||
history_number = History.query.count()
|
history_number = History.query.count()
|
||||||
history = History.query.order_by("created_on desc").limit(4)
|
history = History.query.order_by(History.created_on.desc()).limit(4)
|
||||||
server = Server(server_id='localhost')
|
server = Server(server_id='localhost')
|
||||||
statistics = server.get_statistic()
|
statistics = server.get_statistic()
|
||||||
if statistics:
|
if statistics:
|
||||||
|
Loading…
Reference in New Issue
Block a user