From 6f0bf0f2ef37ae25260e7610bc47ff7346917502 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Fri, 4 Nov 2022 11:42:50 -0700 Subject: [PATCH 1/3] Allow EMAIL_ADMIN_LIST to be configured in Ansible --- bootstrap/ansible/main.copyme | 20 ++++++++++++++++---- bootstrap/ansible/settings_template.tmpl | 4 +++- coldfront/config/test_settings.py.sample | 2 ++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bootstrap/ansible/main.copyme b/bootstrap/ansible/main.copyme index 844257735..ad2fd8854 100644 --- a/bootstrap/ansible/main.copyme +++ b/bootstrap/ansible/main.copyme @@ -133,8 +133,12 @@ common_tasks: True # # TODO: For LRC, use the substring 'MyLRC'. # email_subject_prefix: '[MyBRC-User-Portal]' +# # A list of admin email addresses to be notified about new requests and other +# # events. +# # TODO: Set these addresses to yours. +# email_admin_list: [] # # A list of email addresses to CC when certain requests are processed. -# # TODO: Set this address to yours. +# # TODO: Set these addresses to yours. # request_approval_cc_list: [] ############################################################################### @@ -180,9 +184,13 @@ common_tasks: True # # TODO: For LRC, use the substring 'MyLRC'. # email_subject_prefix: '[MyBRC-User-Portal]' +# # A list of admin email addresses to be notified about new requests and other +# # events. +# # TODO: Set these addresses to yours. +# email_admin_list: [] # # A list of email addresses to CC when certain requests are processed. -# # TODO: Set this address to yours. -# request_approval_cc_list: ['wfeinstein@lbl.gov'] +# # TODO: Set these addresses to yours. +# request_approval_cc_list: [] ############################################################################### # dev_settings @@ -223,6 +231,10 @@ common_tasks: True # # TODO: For LRC, use the substring 'MyLRC'. # email_subject_prefix: '[MyBRC-User-Portal]' +# # A list of admin email addresses to be notified about new requests and other +# # events. +# # TODO: Set these addresses to yours. +# email_admin_list: ['you@email.com'] # # A list of email addresses to CC when certain requests are processed. -# # TODO: Set this address to yours. +# # TODO: Set these addresses to yours. # request_approval_cc_list: ['you@email.com'] diff --git a/bootstrap/ansible/settings_template.tmpl b/bootstrap/ansible/settings_template.tmpl index 0ecad7695..648d1d8a7 100644 --- a/bootstrap/ansible/settings_template.tmpl +++ b/bootstrap/ansible/settings_template.tmpl @@ -21,7 +21,9 @@ CENTER_PROJECT_RENEWAL_HELP_URL = CENTER_BASE_URL + '/help' EMAIL_PORT = {{ email_port }} EMAIL_SUBJECT_PREFIX = '{{ email_subject_prefix }}' -EMAIL_ADMIN_LIST = ['admin@{{ hostname }}'] +# A list of admin email addresses to be notified about new requests and other +# events. +EMAIL_ADMIN_LIST = {{ email_admin_list }} EMAIL_SENDER = '{{ from_email }}' EMAIL_TICKET_SYSTEM_ADDRESS = 'help@{{ hostname }}' EMAIL_DIRECTOR_EMAIL_ADDRESS = 'director@{{ hostname }}' diff --git a/coldfront/config/test_settings.py.sample b/coldfront/config/test_settings.py.sample index 92bb291c8..c728d0db8 100644 --- a/coldfront/config/test_settings.py.sample +++ b/coldfront/config/test_settings.py.sample @@ -21,6 +21,8 @@ CENTER_PROJECT_RENEWAL_HELP_URL = CENTER_BASE_URL + '/help' EMAIL_PORT = 1025 EMAIL_SUBJECT_PREFIX = '[MyBRC-User-Portal]' +# A list of admin email addresses to be notified about new requests and other +# events. EMAIL_ADMIN_LIST = ['admin@localhost'] EMAIL_SENDER = 'test@test.test' EMAIL_TICKET_SYSTEM_ADDRESS = 'help@localhost' From f32d0e0c2b63d15952b89cf630801e07e3277b1a Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Fri, 4 Nov 2022 11:46:27 -0700 Subject: [PATCH 2/3] Default to old value of list if specified list is empty --- bootstrap/ansible/settings_template.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/ansible/settings_template.tmpl b/bootstrap/ansible/settings_template.tmpl index 648d1d8a7..4a4a5d31d 100644 --- a/bootstrap/ansible/settings_template.tmpl +++ b/bootstrap/ansible/settings_template.tmpl @@ -23,7 +23,7 @@ EMAIL_PORT = {{ email_port }} EMAIL_SUBJECT_PREFIX = '{{ email_subject_prefix }}' # A list of admin email addresses to be notified about new requests and other # events. -EMAIL_ADMIN_LIST = {{ email_admin_list }} +EMAIL_ADMIN_LIST = {{ email_admin_list }} or ['admin@{{ hostname }}'] EMAIL_SENDER = '{{ from_email }}' EMAIL_TICKET_SYSTEM_ADDRESS = 'help@{{ hostname }}' EMAIL_DIRECTOR_EMAIL_ADDRESS = 'director@{{ hostname }}' From 2d5c206dfb3c61dc41c101a75fb78797d296c7b3 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Fri, 4 Nov 2022 11:57:54 -0700 Subject: [PATCH 3/3] Include the setting in README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bff43b546..397354eca 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ that quotes need not be provided, except in the list variable. redis_passwd: password_here from_email: you@email.com admin_email: you@email.com + email_admin_list: ["you@email.com"] request_approval_cc_list: ["you@email.com"] ``` 8. Provision the VM. This should run the Ansible playbook. Expect this to take