From e2192aacdaec3b616792e2a7ac02f3debc8633f9 Mon Sep 17 00:00:00 2001 From: Kelly Lockhart <2926089+kelockhart@users.noreply.github.com> Date: Wed, 22 May 2024 15:47:43 -0400 Subject: [PATCH 1/2] Added flag to disable emails for user-input email addresses --- run.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/run.py b/run.py index 235cf07..de48740 100644 --- a/run.py +++ b/run.py @@ -442,7 +442,7 @@ def notifications_status_update(user_emails=None, active=False): dest='user_emails', action='store', default=None, - help='Comma delimited list of user emails to run myADS notifications for') + help='Comma delimited list of user emails to process') parser.add_argument('-d', '--daily', @@ -558,16 +558,19 @@ def notifications_status_update(user_emails=None, active=False): sys.exit(1) if args.bounceback_disable: - bounceback_email_file = os.path.join(config.get('BOUNCEBACK_EMAIL_DIR'), 'myADS.bounces.emails') - bounceback_emails = [] - try: - with open(bounceback_email_file, 'rt') as flist: - for l in flist.readlines(): - bounceback_emails.append(l.strip()) - except IOError: - logger.warning('Bounceback email file not found. Exiting.') - # exit with error - sys.exit(1) + if args.user_emails: + bounceback_emails = args.user_emails + else: + bounceback_email_file = os.path.join(config.get('BOUNCEBACK_EMAIL_DIR'), 'myADS.bounces.emails') + bounceback_emails = [] + try: + with open(bounceback_email_file, 'rt') as flist: + for l in flist.readlines(): + bounceback_emails.append(l.strip()) + except IOError: + logger.warning('Bounceback email file not found. Exiting.') + # exit with error + sys.exit(1) if bounceback_emails: disabled_dict = notifications_status_update(user_emails=bounceback_emails, active=False) @@ -577,9 +580,10 @@ def notifications_status_update(user_emails=None, active=False): # note: we're ignoring failed disabling from here on - there's a possibility that this email address is # dead, so we can ignore. If it's not dead, then it'll just show back up in the bounceback file next time # and we can try it again then - old_file = os.path.join(config.get('BOUNCEBACK_EMAIL_DIR'), - 'myADS.bounces.emails' + '.' + get_date().strftime('%Y%m%d')) - os.rename(bounceback_email_file, old_file) + if not args.user_emails: + old_file = os.path.join(config.get('BOUNCEBACK_EMAIL_DIR'), + 'myADS.bounces.emails' + '.' + get_date().strftime('%Y%m%d')) + os.rename(bounceback_email_file, old_file) else: logger.info('No bounceback emails to process; exiting.') # exit without error From d75d41cf3450edb2e41f2b69ba20785b8aeaa192 Mon Sep 17 00:00:00 2001 From: Kelly Lockhart <2926089+kelockhart@users.noreply.github.com> Date: Wed, 22 May 2024 17:08:46 -0400 Subject: [PATCH 2/2] Fix Github workflow issue --- .github/workflows/python_actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_actions.yml b/.github/workflows/python_actions.yml index f29c073..e2941db 100644 --- a/.github/workflows/python_actions.yml +++ b/.github/workflows/python_actions.yml @@ -48,7 +48,7 @@ jobs: run: | py.test - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: coverage-myads path: .coverage