From dfcba9236d46309063735832f8fb938ea015495f Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 27 Jul 2017 15:39:49 +0200 Subject: [PATCH] Bugfixing --- pp_lib/import_pdnsdata.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pp_lib/import_pdnsdata.py b/pp_lib/import_pdnsdata.py index a33be38..db6f0ac 100644 --- a/pp_lib/import_pdnsdata.py +++ b/pp_lib/import_pdnsdata.py @@ -30,7 +30,7 @@ from .common import pp, to_bool from .cfg_app import PpCfgAppError, PpConfigApplication -__version__ = '0.7.3' +__version__ = '0.7.4' LOG = logging.getLogger(__name__) # ============================================================================= @@ -555,7 +555,10 @@ class ImportPdnsdataApp(PpConfigApplication): result = tgt_cursor.fetchone() if self.verbose > 3: LOG.debug("Got max Zone Template Permission Id:\n{}".format(pp(result))) - max_id = int(result[0]) + if result[0] is not None: + max_id = int(result[0]) + else: + max_id = 0 sql = "SELECT SETVAL('perm_templ_items_id_seq', %s)" LOG.debug("Setting curval of perm_templ_items_id_seq to {} ...".format(max_id)) if self.verbose > 1: @@ -1252,7 +1255,7 @@ class ImportPdnsdataApp(PpConfigApplication): INSERT INTO zone_templ_records ( zone_templ_id, name, type, content, ttl, prio) VALUES ( - %(zone_templ_id)s, %(name)s, %(type)s, %(content)s, %(ttl)s, %(prio)) + %(zone_templ_id)s, %(name)s, %(type)s, %(content)s, %(ttl)s, %(prio)s) ''').strip() if self.verbose > 1: LOG.debug("Target SQL:\n{}".format(tgt_sql)) -- 2.39.5