I have noticed that the script remove_members doesn't exit with 0 after
a couple of error conditions. Therefore, my external script seems to
think that processing unsubscribes has gone OK when in fact sometimes
this is not the case.
The main problem is just that the main "for" loop for processing
removals has no way to tell if there are multiple lists being processed
or not, so it continues after a list error thinking there might be
another list to try. In my case I only ever treat one list at once, but
the continue allows processing to continue and a (default?) exit with 0.
Also, if a file is specified on the command line and doesn't exist, this
causes an error which does not cause exit to happen immediately and can
cause a return value of 0 in a clear error condition.
Attached a diff which is a cold blooded hack at best, but then it works
for me and I've been having a lot of db crashes recently so I have to
eliminate all possible wierd lock situations and stuff until I know
what's really going on. Diff also corrects a one word omission from the
usage help page i.e. the one displayed on command line argument errors
or if called without arguments.
Cheers,
--
Simon White. Internet Consultant, Linux/Windows Server Administration.
email, dns and web servers; php javascript perl asp; MySQL MSSQL Access
Bridging the gap between management, HR and the tech team.
*** remove_members Tue Jan 13 12:26:00 2004
--- remove_members.new Tue Jan 13 12:26:48 2004
***************
*** 36,43 ****
--fromall
Removes the given addresses from all the lists on this system
regardless of virtual domains if you have any. This option cannot be
! used -a/--all. Also, you should not specify a listname when using
! this option.
--nouserack
-n
--- 36,43 ----
--fromall
Removes the given addresses from all the lists on this system
regardless of virtual domains if you have any. This option cannot be
! used with -a/--all. Also, you should not specify a listname when
! using this option.
--nouserack
-n
***************
*** 154,170 ****
--- 154,174 ----
addresses = addresses + ReadFile(filename)
except IOError:
print _('Could not open file for reading: %(filename)s.')
+ sys.exit(1)
for listname in listnames:
try:
# open locked
mlist = MailList.MailList(listname)
+ exitclean = 1
except Errors.MMListError:
print _('Error opening list %(listname)s... skipping.')
+ exitclean = 0
continue
if all:
addresses = mlist.getMembers()
+ exitclean = 1
try:
for addr in addresses:
***************
*** 179,185 ****
mlist.Save()
finally:
mlist.Unlock()
!
if __name__ == '__main__':
--- 183,191 ----
mlist.Save()
finally:
mlist.Unlock()
!
! if exitclean == 0:
! sys.exit(1)
if __name__ == '__main__':
------------------------------------------------------
Mailman-Users mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
This message was sent to: [EMAIL PROTECTED]
Unsubscribe or change your options at
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org