bin/rmlist -a does not removes the database of a Dlist automatically instead always gives an error message in error log

Bug #555864 reported by kanika vats
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Systers-mailman
Fix Committed
Undecided
Unassigned

Bug Description

It seems support for Dlist was added in /bin/rmlist by the following lines:

# Remove the database in PostgreSQL if it was a dynamic list. Added by Systers.
    try:
        conn = DlistUtils.getConn(None)
        old_iso_lvl = conn.isolation_level
        conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
        cursor = conn.cursor()
        cursor.execute('DROP DATABASE "%s"' % listname)
        conn.set_isolation_level(old_iso_lvl)
    except:
        syslog('error', 'Tried to remove the database for %s, no such database (ok if it was a non dlist). If it was a dlist, the postgreSQL database for this list needs to be removed manually.' % listname)

But every time we try to delete a dlist by using the command bin/rmlist -a then everything gets deleted besides the database and always the except part of the above lines of code is executed.

The reason behind this is that:
Every time for executing store functions(in DlistUtils.py) you needed to

1)Establish connection with Database via
'database = getConn(mlist)'
(If you see getConn() function in DlistUtils.py you will find that create_database() is used to create this cursor)

2)The 'database' cursor so generated was later on used for creating a store object corresponding to that database using
store = Store(database).

This cursor generated is different from the cursor that is generated via
'conn = pgdb.connect(host='localhost', database='postgres',user='mailman', password='mailman')'.
This was used before storm was implemented.Unfortunately the cursor used with storm does not provides option for setting 'ISOLATION_LEVEL_AUTOCOMMIT'.

Therefore I had left the function used for creating database(_create_database()) with isolation level autocommit same as before.It still uses pgdb.connect to establish connection with database.

Since above getConn() is being used for creating the cursor 'conn' therefore "conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)"
always gives an error hence except part is executed always.

Revision history for this message
kanika vats (kanika-krikan) wrote :

I have solved the bug.Will commit the changes soon.

Revision history for this message
kanika vats (kanika-krikan) wrote :

Pushed up revision 74 to lp:~systers-soc/systers/stable

Changed in systers:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.