Merge pull request #647 from eht16/fix_typos

Fiy typos in logging messages
This commit is contained in:
Khanh Ngo 2020-01-29 22:21:29 +07:00 committed by GitHub
commit dbb181d575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View File

@ -116,7 +116,7 @@ class Domain(db.Model):
db_domain = Domain.query.all() db_domain = Domain.query.all()
list_db_domain = [d.name for d in db_domain] list_db_domain = [d.name for d in db_domain]
dict_db_domain = dict((x.name, x) for x in db_domain) dict_db_domain = dict((x.name, x) for x in db_domain)
current_app.logger.info("Found {} entrys in PowerDNS-Admin".format( current_app.logger.info("Found {} entries in PowerDNS-Admin".format(
len(list_db_domain))) len(list_db_domain)))
headers = {} headers = {}
headers['X-API-Key'] = self.PDNS_API_KEY headers['X-API-Key'] = self.PDNS_API_KEY
@ -128,7 +128,7 @@ class Domain(db.Model):
timeout=int(Setting().get('pdns_api_timeout'))) timeout=int(Setting().get('pdns_api_timeout')))
list_jdomain = [d['name'].rstrip('.') for d in jdata] list_jdomain = [d['name'].rstrip('.') for d in jdata]
current_app.logger.info( current_app.logger.info(
"Found {} entrys in PowerDNS server".format(len(list_jdomain))) "Found {} entries in PowerDNS server".format(len(list_jdomain)))
try: try:
# domains should remove from db since it doesn't exist in powerdns anymore # domains should remove from db since it doesn't exist in powerdns anymore
@ -267,7 +267,7 @@ class Domain(db.Model):
headers=headers, headers=headers,
timeout=int(Setting().get('pdns_api_timeout'))) timeout=int(Setting().get('pdns_api_timeout')))
except Exception as e: except Exception as e:
current_app.logger.error('Can not read Domain from PDNS') current_app.logger.error('Can not read domain from PDNS')
current_app.logger.error(e) current_app.logger.error(e)
current_app.logger.debug(traceback.format_exc()) current_app.logger.debug(traceback.format_exc())
@ -292,7 +292,7 @@ class Domain(db.Model):
try: try:
db.session.commit() db.session.commit()
current_app.logger.info( current_app.logger.info(
"Synched PowerDNS Domain to PDNS-Admin: {0}".format(d.name)) "Synced PowerDNS Domain to PDNS-Admin: {0}".format(d.name))
return { return {
'status': 'ok', 'status': 'ok',
'msg': 'Added Domain successfully to PowerDNS-Admin' 'msg': 'Added Domain successfully to PowerDNS-Admin'
@ -305,7 +305,7 @@ class Domain(db.Model):
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()
if not domain: if not domain:
return {'status': 'error', 'msg': 'Domain doesnt exist.'} return {'status': 'error', 'msg': 'Domain does not exist.'}
headers = {} headers = {}
headers['X-API-Key'] = self.PDNS_API_KEY headers['X-API-Key'] = self.PDNS_API_KEY
@ -345,7 +345,7 @@ class Domain(db.Model):
domain_name)) domain_name))
return { return {
'status': 'error', 'status': 'error',
'msg': 'Cannot change soa-edit-api this domain.' 'msg': 'Cannot change soa-edit-api for this domain.'
} }
def update_kind(self, domain_name, kind, masters=[]): def update_kind(self, domain_name, kind, masters=[]):
@ -354,7 +354,7 @@ class Domain(db.Model):
""" """
domain = Domain.query.filter(Domain.name == domain_name).first() domain = Domain.query.filter(Domain.name == domain_name).first()
if not domain: if not domain:
return {'status': 'error', 'msg': 'Domain doesnt exist.'} return {'status': 'error', 'msg': 'Domain does not exist.'}
headers = {} headers = {}
headers['X-API-Key'] = self.PDNS_API_KEY headers['X-API-Key'] = self.PDNS_API_KEY
@ -496,7 +496,7 @@ class Domain(db.Model):
timeout=int(Setting().get('pdns_api_timeout')), timeout=int(Setting().get('pdns_api_timeout')),
method='DELETE') method='DELETE')
current_app.logger.info( current_app.logger.info(
'Deleted domain successfully from PowerDNS-Entity: {0}'.format( 'Deleted domain successfully from PowerDNS: {0}'.format(
domain_name)) domain_name))
return {'status': 'ok', 'msg': 'Delete domain successfully'} return {'status': 'ok', 'msg': 'Delete domain successfully'}
@ -520,7 +520,7 @@ class Domain(db.Model):
Domain.query.filter(Domain.name == domain_name).delete() Domain.query.filter(Domain.name == domain_name).delete()
db.session.commit() db.session.commit()
current_app.logger.info( current_app.logger.info(
"Deleted Domain successfully from pdnsADMIN: {}".format( "Deleted domain successfully from pdnsADMIN: {}".format(
domain_name)) domain_name))
def get_user(self): def get_user(self):

View File

@ -261,7 +261,7 @@ def api_generate_apikey():
elif role_name == 'User': elif role_name == 'User':
domain_obj_list = Domain.query.filter(Domain.name.in_(domains)).all() domain_obj_list = Domain.query.filter(Domain.name.in_(domains)).all()
if len(domain_obj_list) == 0: if len(domain_obj_list) == 0:
msg = "One of supplied domains does not exists" msg = "One of supplied domains does not exist"
current_app.logger.error(msg) current_app.logger.error(msg)
raise DomainNotExists(message=msg) raise DomainNotExists(message=msg)
@ -406,7 +406,7 @@ def api_update_apikey(apikey_id):
elif role_name == 'User': elif role_name == 'User':
domain_obj_list = Domain.query.filter(Domain.name.in_(domains)).all() domain_obj_list = Domain.query.filter(Domain.name.in_(domains)).all()
if len(domain_obj_list) == 0: if len(domain_obj_list) == 0:
msg = "One of supplied domains does not exists" msg = "One of supplied domains does not exist"
current_app.logger.error(msg) current_app.logger.error(msg)
raise DomainNotExists(message=msg) raise DomainNotExists(message=msg)