diff options
| author | Barry Warsaw | 2014-03-02 15:59:30 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2014-03-02 15:59:30 -0500 |
| commit | 59c7ae5b05ffd9d1663b5c8102afe56eb7458e37 (patch) | |
| tree | e0d1212672bfe2d256bcfb76a174e5577f51ec67 /src/mailman/app/lifecycle.py | |
| parent | 11d3120dd10a5ef0d026f9495bbacdd89f0ce7bf (diff) | |
| download | mailman-59c7ae5b05ffd9d1663b5c8102afe56eb7458e37.tar.gz mailman-59c7ae5b05ffd9d1663b5c8102afe56eb7458e37.tar.zst mailman-59c7ae5b05ffd9d1663b5c8102afe56eb7458e37.zip | |
Diffstat (limited to 'src/mailman/app/lifecycle.py')
| -rw-r--r-- | src/mailman/app/lifecycle.py | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/mailman/app/lifecycle.py b/src/mailman/app/lifecycle.py index c2c4047ae..676953ebe 100644 --- a/src/mailman/app/lifecycle.py +++ b/src/mailman/app/lifecycle.py @@ -27,6 +27,7 @@ __all__ = [ import os +import errno import shutil import logging @@ -98,27 +99,13 @@ def create_list(fqdn_listname, owners=None, style_name=None): def remove_list(mlist): """Remove the list and all associated artifacts and subscriptions.""" fqdn_listname = mlist.fqdn_listname - removeables = [] # Delete the mailing list from the database. getUtility(IListManager).delete(mlist) # Do the MTA-specific list deletion tasks call_name(config.mta.incoming).delete(mlist) - # Remove the list directory. - removeables.append(os.path.join(config.LIST_DATA_DIR, fqdn_listname)) - # Remove any stale locks associated with the list. - for filename in os.listdir(config.LOCK_DIR): - fn_listname, dot, rest = filename.partition('.') - if fn_listname == fqdn_listname: - removeables.append(os.path.join(config.LOCK_DIR, filename)) - # Now that we know what files and directories to delete, delete them. - for target in removeables: - if not os.path.exists(target): - pass - elif os.path.islink(target): - os.unlink(target) - elif os.path.isdir(target): - shutil.rmtree(target) - elif os.path.isfile(target): - os.unlink(target) - else: - log.error('Could not delete list artifact: %s', target) + # Remove the list directory, if it exists. + try: + shutil.rmtree(os.path.join(config.LIST_DATA_DIR, fqdn_listname)) + except OSError as error: + if error.errno != errno.ENOENT: + raise |
