if not self.simulate:
tgt_cursor.execute(sql)
- LOG.debug("Get max. Zone Template Permission Id ...")
- sql = "SELECT MAX(id) AS max_id FROM perm_templ_items"
- if self.verbose > 1:
- LOG.debug("SQL: {}".format(sql))
- tgt_cursor.execute(sql)
- result = tgt_cursor.fetchone()
- if self.verbose > 3:
- LOG.debug("Got max Zone Template Permission Id:\n{}".format(pp(result)))
- 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:
- LOG.debug("SQL: {}".format(sql))
- if not self.simulate:
- tgt_cursor.execute(sql, (max_id, ))
+ if self.tgt_db_is_poweradmin:
+ LOG.debug("Get max. Zone Template Permission Id ...")
+ sql = "SELECT MAX(id) AS max_id FROM perm_templ_items"
+ if self.verbose > 1:
+ LOG.debug("SQL: {}".format(sql))
+ tgt_cursor.execute(sql)
+ result = tgt_cursor.fetchone()
+ if self.verbose > 3:
+ LOG.debug("Got max Zone Template Permission Id:\n{}".format(pp(result)))
+ 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:
+ LOG.debug("SQL: {}".format(sql))
+ if not self.simulate:
+ tgt_cursor.execute(sql, (max_id, ))
- sql = "SELECT SETVAL('zone_templ_records_id_seq', 0)"
- LOG.debug("Setting curval of zone_templ_records_id_seq to {} ...".format(0))
- if self.verbose > 1:
- LOG.debug("SQL: {}".format(sql))
- if not self.simulate:
- tgt_cursor.execute(sql, (max_id, ))
+ sql = "SELECT SETVAL('zone_templ_records_id_seq', 0)"
+ LOG.debug("Setting curval of zone_templ_records_id_seq to {} ...".format(0))
+ if self.verbose > 1:
+ LOG.debug("SQL: {}".format(sql))
+ if not self.simulate:
+ tgt_cursor.execute(sql, (max_id, ))
- sql = "SELECT SETVAL('zones_id_seq', 0)"
- LOG.debug("Setting curval of zones_id_seq to {} ...".format(0))
- if self.verbose > 1:
- LOG.debug("SQL: {}".format(sql))
- if not self.simulate:
- tgt_cursor.execute(sql, (max_id, ))
+ sql = "SELECT SETVAL('zones_id_seq', 0)"
+ LOG.debug("Setting curval of zones_id_seq to {} ...".format(0))
+ if self.verbose > 1:
+ LOG.debug("SQL: {}".format(sql))
+ if not self.simulate:
+ tgt_cursor.execute(sql, (max_id, ))
LOG.debug("Commiting changes ...")
self.tgt_connection.commit()