mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-12 16:40:26 +00:00
Remove blank lines and spaces
This commit is contained in:
parent
a21d4d9cbd
commit
ad86f8ea2a
@ -918,7 +918,7 @@ class Domain(db.Model):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error('Can not delete domain from DB. DETAIL: {0}'.format(e))
|
logging.error('Can not delete domain from DB. DETAIL: {0}'.format(e))
|
||||||
logging.debug(traceback.format_exc())
|
logging.debug(traceback.format_exc())
|
||||||
|
|
||||||
# update/add new domain
|
# update/add new domain
|
||||||
for data in jdata:
|
for data in jdata:
|
||||||
if 'account' in data:
|
if 'account' in data:
|
||||||
@ -934,7 +934,6 @@ class Domain(db.Model):
|
|||||||
# add new domain
|
# add new domain
|
||||||
self.add_domain_to_powerdns_admin(domain=data)
|
self.add_domain_to_powerdns_admin(domain=data)
|
||||||
|
|
||||||
|
|
||||||
logging.info('Update finished')
|
logging.info('Update finished')
|
||||||
return {'status': 'ok', 'msg': 'Domain table has been updated successfully'}
|
return {'status': 'ok', 'msg': 'Domain table has been updated successfully'}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -950,7 +949,7 @@ class Domain(db.Model):
|
|||||||
or domain.last_check != (1 if data['last_check'] else 0)
|
or domain.last_check != (1 if data['last_check'] else 0)
|
||||||
or domain.dnssec != data['dnssec']
|
or domain.dnssec != data['dnssec']
|
||||||
or domain.account_id != account_id):
|
or domain.account_id != account_id):
|
||||||
|
|
||||||
domain.master = str(data['masters'])
|
domain.master = str(data['masters'])
|
||||||
domain.type = data['kind']
|
domain.type = data['kind']
|
||||||
domain.serial = data['serial']
|
domain.serial = data['serial']
|
||||||
@ -966,7 +965,6 @@ class Domain(db.Model):
|
|||||||
logging.info("Rolledback Domain {0} {1}".format(domain.name, e))
|
logging.info("Rolledback Domain {0} {1}".format(domain.name, e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def add(self, domain_name, domain_type, soa_edit_api, domain_ns=[], domain_master_ips=[], account_name=None):
|
def add(self, domain_name, domain_type, soa_edit_api, domain_ns=[], domain_master_ips=[], account_name=None):
|
||||||
"""
|
"""
|
||||||
Add a domain to power dns
|
Add a domain to power dns
|
||||||
@ -1009,7 +1007,6 @@ class Domain(db.Model):
|
|||||||
logging.debug(traceback.format_exc())
|
logging.debug(traceback.format_exc())
|
||||||
return {'status': 'error', 'msg': 'Cannot add this domain.'}
|
return {'status': 'error', 'msg': 'Cannot add this domain.'}
|
||||||
|
|
||||||
|
|
||||||
def add_domain_to_powerdns_admin(self, domain=None, domain_dict=None):
|
def add_domain_to_powerdns_admin(self, domain=None, domain_dict=None):
|
||||||
"""
|
"""
|
||||||
Read Domain from PowerDNS and add into PDNS-Admin
|
Read Domain from PowerDNS and add into PDNS-Admin
|
||||||
@ -1049,8 +1046,7 @@ class Domain(db.Model):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logging.info("Rolledback Domain {0}".format(d.name))
|
logging.info("Rolledback Domain {0}".format(d.name))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def update_soa_setting(self, domain_name, soa_edit_api):
|
def update_soa_setting(self, domain_name, soa_edit_api):
|
||||||
domain = Domain.query.filter(Domain.name == domain_name).first()
|
domain = Domain.query.filter(Domain.name == domain_name).first()
|
||||||
@ -1147,7 +1143,7 @@ class Domain(db.Model):
|
|||||||
def delete(self, domain_name):
|
def delete(self, domain_name):
|
||||||
"""
|
"""
|
||||||
Delete a single domain name from powerdns
|
Delete a single domain name from powerdns
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.delete_domain_from_powerdns(domain_name)
|
self.delete_domain_from_powerdns(domain_name)
|
||||||
self.delete_domain_from_pdnsadmin(domain_name)
|
self.delete_domain_from_pdnsadmin(domain_name)
|
||||||
@ -1156,7 +1152,7 @@ class Domain(db.Model):
|
|||||||
logging.error('Cannot delete domain {0}'.format(domain_name))
|
logging.error('Cannot delete domain {0}'.format(domain_name))
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
logging.debug(traceback.format_exc())
|
logging.debug(traceback.format_exc())
|
||||||
return {'status': 'error', 'msg': 'Cannot delete domain'}
|
return {'status': 'error', 'msg': 'Cannot delete domain'}
|
||||||
|
|
||||||
def delete_domain_from_powerdns(self, domain_name):
|
def delete_domain_from_powerdns(self, domain_name):
|
||||||
"""
|
"""
|
||||||
@ -1184,7 +1180,7 @@ class Domain(db.Model):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
domain.apikeys[:] = []
|
domain.apikeys[:] = []
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
# then remove domain
|
# then remove domain
|
||||||
Domain.query.filter(Domain.name == domain_name).delete()
|
Domain.query.filter(Domain.name == domain_name).delete()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
@ -1460,7 +1456,6 @@ class Record(object):
|
|||||||
This is not a model, it's just an object
|
This is not a model, it's just an object
|
||||||
which be assigned data from PowerDNS API
|
which be assigned data from PowerDNS API
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name=None, type=None, status=None, ttl=None, data=None):
|
def __init__(self, name=None, type=None, status=None, ttl=None, data=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.type = type
|
self.type = type
|
||||||
|
Loading…
Reference in New Issue
Block a user