def delete_group(group_id=None): try: cursor = db.execute('delete from grp where id = %s', [group_id]) db.execute('delete from grp_host where grp_id = %s', [group_id], cursor=cursor) db.execute('delete from grp_tpl where grp_id = %s', [group_id], cursor=cursor) db.execute('delete from plugin_dir where grp_id = %s', [group_id], cursor=cursor) db.commit() return '' except Exception, e: log.error(e) db.rollback() return 'delete group %s fail' % group_id
def app_teardown(exception): from rrd.store import db, alarm_db db.commit() alarm_db.commit()