diff options
author | Simo Sorce <simo@redhat.com> | 2014-04-04 13:26:02 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2014-04-04 13:33:09 -0400 |
commit | b6a436f76177c0180af3e0e70a88d3f974ac717d (patch) | |
tree | d689c9dae9a91426de992914942bb8101f8e084b /ipsilon/util/data.py | |
parent | e3547ec9148642659c3708db8a54fb008b1d9995 (diff) | |
download | ipsilon.git-b6a436f76177c0180af3e0e70a88d3f974ac717d.tar.gz ipsilon.git-b6a436f76177c0180af3e0e70a88d3f974ac717d.tar.xz ipsilon.git-b6a436f76177c0180af3e0e70a88d3f974ac717d.zip |
Add infrastructure to delete plugin data by id
Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'ipsilon/util/data.py')
-rwxr-xr-x | ipsilon/util/data.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index 52dfa78..7d0e0ff 100755 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -396,6 +396,23 @@ class Store(object): if con: con.close() + def del_datum(self, plugin, idval): + DELETE = "DELETE FROM %s_data WHERE id=?" % plugin + con = None + try: + con = sqlite3.connect(self._admin_dbname) + cur = con.cursor() + cur.execute(DELETE, (idval,)) + con.commit() + except sqlite3.Error, e: + if con: + con.rollback() + cherrypy.log.error("Failed to delete %s data: [%s]" % (plugin, e)) + raise + finally: + if con: + con.close() + def wipe_data(self, plugin): # Try to backup old data first, just in case try: |