Ian R. Justman wrote:

Hi, all.

Thanks for your thoughts on my previous questions.

Now, I have a new dilemma on my hands.

I'm trying to adapt the script "postfix-to-mailman.py" to operate with Ecartis rather than Mailman. What it boils down to is that I'm not having a lot of luck with it right now.

First, some knowns:

1. I have the original script, postfix-to-mailman.py, working with an existing Mailman installation. I really like how it works which is why I'm using this as a base (why reinvent the wheel?). Some ancillary info: this is for a list which a friend of mine runs, notably the IRCServices-related lists.

2. I am installing Ecartis for another entity--one I helped found--because I'm far more comfortable with it and I used it before.

3. I don't like dealing with aliases for mailing lists. They cause unnecessary clutter.

4.  I like Ecartis.  (Important)

5.  I hate Mailman.  (Really important)

6.  I don't know jack about Python.  (Extremely important)

The postfix-to-python.py (and by extension, my adaptation, postfix-to-ecartis.py) are set up as pipe transports, the entry for which in /etc/master.cf being something like this:

mailman   unix  -       n       n       -       -       pipe
flags=FR user=mailman argv=/[...]/mailman/mailman-base/postfix-to-mailman.py
  ${nexthop} ${user}

And in this case, it's called with the following line in a transport table (this is the actual line):

ircservices.za.net               mailman:

The Ecartis incarnation is named "ecartis" and is formed the same in master.cf as indicated above, but the file is located in a different spot on my filesystem, and a different domain points to that entry.

I've made some basic changes, the obvious ones being from the mailman executables to ecartis, as well as to how Ecartis handles list names and addresses as well as command flags. They don't seem to be enough at this point. Furthermore, my lack of Python-fu helps matters even less.

Now, with all that said, what's a good way to debug a persnickety pipe transport when all that shows up in the log is a "temporary error" once all the basic stuff the script CAN report as written has been taken care of? What kind of facilities can Postfix offer in terms of aiding in debugging?


you should run the script manually (as the user that is supposed to run it, not as root or as yourself) instead of via postfix.


Postfix-specific stuff aside, what's a good basic reference for a Python n00b? I am even tendering the thought of just ditching this thing in favor of writing a script in a language I do know, Perl.


if you are more confortable with perl, use perl. here is an example using a shell script instead. This example assumes addresses of the form [EMAIL PROTECTED] (i.e. the domain part is not used) and it calls the list manager as '/path/to/mlm listname listcommand'.


== transport
lists.example.com       listmanager:


== master.cf
listmanager unix  -       n       n       -       -       pipe
      flags=FR user=${listmanager_user}
      argv=${listmanager_command} ${user} ${extension}

== main.cf
listmanager_user = mailman:mailman
lismanager_command = /usr/local/bin/listmanager.sh
owner_request_special = no

== listmanager.sh
#!/bin/sh

list="$1"
command="$2"

mlm=/path/to/mlm


if [ -z ${command} ]; then
    command=post
fi

# we pass unknown commands to -owner. it is too late to bounce
# use access maps to reject unknown commands.
case ${command} in

admin|bounces|confirm|join|leave|owner|request|subscribe|unsubscribe|post)
        ;;
    *)
        command="owner";
esac

#echo "cmd=$command, list=$list" >> /tmp/listmgr.log

cat | $mlm "$command" "$list"





Reply via email to