BIND 10 #2575: implement DataSourceClient::deleteZone and its SQLite3 implementation
BIND 10 Development
do-not-reply at isc.org
Fri Dec 21 07:36:04 UTC 2012
#2575: implement DataSourceClient::deleteZone and its SQLite3 implementation
-------------------------------------+-------------------------------------
Reporter: jinmei | Owner:
Type: task | Status: new
Priority: medium | Milestone: New
Component: data source | Tasks
Keywords: | Resolution:
Sensitive: 0 | CVSS Scoring:
Sub-Project: DNS | Defect Severity: N/A
Estimated Difficulty: 0 | Feature Depending on Ticket:
Total Hours: 0 | loadzone-ng
| Add Hours to Ticket: 0
| Internal?: 0
-------------------------------------+-------------------------------------
Comment (by jinmei):
Replying to [comment:1 vorner]:
> Um, what for?
To replace this ugly hack in b10-loadzone:
{{{#!python
def __cancel_create(self):
'''sqlite3-only hack: delete the zone just created on load
failure.
This should eventually be done via generic datasrc API, but right
now
we don't have that interface. Leaving the zone in this situation
is too bad, so we handle it with a workaround.
'''
if self._datasrc_type is not 'sqlite3':
return
import sqlite3 # we need the module only here
import json
# If we are here, the following should basically succeed; since
# this is considered a temporary workaround we don't bother to
catch
# and recover rare failure cases.
dbfile = json.loads(self._datasrc_config)['database_file']
with sqlite3.connect(dbfile) as conn:
cur = conn.cursor()
cur.execute("DELETE FROM zones WHERE name = ?",
[self._zone_name.to_text()])
}}}
--
Ticket URL: <http://bind10.isc.org/ticket/2575#comment:2>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list