From 7ac90e5d2aaf97e3ac0f552991001a11d6f52d5b Mon Sep 17 00:00:00 2001 From: Jigme Datse Yli-Rasku Date: Thu, 30 May 2024 00:04:20 -0700 Subject: [PATCH] Fix problem with no arguments This is currently getting called with no arguments, and requires (as stands) 2. I'd handled the lack of 1 argument previously, but as of getting further along the second argument is missing. --- docs/courier-to-mailman3.md | 3 ++- source/courier-to-mailman3.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/courier-to-mailman3.md b/docs/courier-to-mailman3.md index d068fa5..5fbe6c1 100644 --- a/docs/courier-to-mailman3.md +++ b/docs/courier-to-mailman3.md @@ -34,4 +34,5 @@ This is our current version trying to communicate between courier and mailman3. * Catch exception, log based on that? * Hm, go with bare "Exception"... The catch wasn't what was failing. * Let's try that instead? -* Oh man... Variable not properly defined (or more derferenced.) \ No newline at end of file +* Oh man... Variable not properly defined (or more derferenced.) +* OK, it's failing further along, so maybe this works? \ No newline at end of file diff --git a/source/courier-to-mailman3.py b/source/courier-to-mailman3.py index f0f74ac..58a0eac 100644 --- a/source/courier-to-mailman3.py +++ b/source/courier-to-mailman3.py @@ -50,7 +50,8 @@ try: # for qmail command docs and supplied environment variables. # We need to replace "1" with an empty string, as qmail only supports EXT, # EXT2, EXT3, EXT4. - arg_ext = sys.argv[2] if sys.argv[2] != "1" else "" + arg_ext_tmp = sys.argv[2] if len(sys.argv) > 2 else "1" + arg_ext = arg_ext_tmp if arg_ext_tmp != "1" else "" lmtp.sendmail( os.environ['SENDER'], os.environ['EXT' + arg_ext] + "@" + os.environ['HOST'],