Skip to content

Commit a6dcaa0

Browse files
authored
EL and Tech Lead emails included into CC list (#65)
* EL and Tech Lead inluded into CC list Engagement and Tech leads should be included in CC list for all notifications. * Checks for empty EL or TechLead emails It's possible that EL or TechLead email can be empty or missed completely. Logic added to properly handle such situations. * Fix for leading spaces Set two leading spaces for the CC list in the generated yaml file.
1 parent e1538d9 commit a6dcaa0

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

inventory-generation/notifications/templates/list-of-users.yaml.j2

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,21 @@ internal:
1414
{% filter indent(width=6) %}
1515
{% if 'redhat.com' in user.email %}
1616
- {{ user | to_nice_yaml }}
17-
{% endif %}
17+
{%- endif %}
1818
{%- endfilter %}
1919
{%- endfor %}
2020

21+
{%- set users = [] %}
22+
{% if engagement_lead_email is defined and engagement_lead_email|length %}
23+
{{ users.append(engagement_lead_email) }}
24+
{%- endif %}
25+
{% if technical_lead_email is defined and technical_lead_email|length %}
26+
{{ users.append(technical_lead_email) }}
27+
{%- endif %}
28+
29+
{% if users %}
30+
list_of_mail_cc:
31+
{% for user in users %}
32+
- {{ user }}
33+
{% endfor %}
34+
{%- endif %}

inventory-generation/tower_jobs_schedules/templates/tower-management-host.yaml.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ ansible_tower:
6464
body: {% raw %}"{{ welcome_internal.body }}"{% endraw %}
6565
title: {% raw %}"{{ welcome_internal.title }}"{% endraw %}
6666
list_of_users: {% raw %}"{{ internal.list_of_users | default([]) }}"{% endraw %}
67+
list_of_mail_cc: {% raw %}"{{ list_of_mail_cc | default([]) }}"{% endraw %}
6768
- name: "{{ customer_engagement }}-welcome-all"
6869
description: "Welcome notification for {{ company_name }} and {{ customer_name }}"
6970
{% raw -%}
@@ -75,6 +76,7 @@ ansible_tower:
7576
body: {% raw %}"{{ welcome_all.body }}"{% endraw %}
7677
title: {% raw %}"{{ welcome_all.title }}"{% endraw %}
7778
list_of_users: {% raw %}"{{ full.list_of_users | default([]) }}"{% endraw %}
79+
list_of_mail_cc: {% raw %}"{{ list_of_mail_cc | default([]) }}"{% endraw %}
7880
- name: "{{ customer_engagement }}-pre-offboard"
7981
description: "Pre-offboard"
8082
{% raw -%}
@@ -86,6 +88,7 @@ ansible_tower:
8688
body: {% raw %}"{{ pre_offboard.body }}"{% endraw %}
8789
title: {% raw %}"{{ pre_offboard.title }}"{% endraw %}
8890
list_of_users: {% raw %}"{{ full.list_of_users | default([]) }}"{% endraw %}
91+
list_of_mail_cc: {% raw %}"{{ list_of_mail_cc | default([]) }}"{% endraw %}
8992
- name: "{{ customer_engagement }}-offboard-1"
9093
description: "Offboard 1"
9194
{% raw -%}
@@ -97,6 +100,7 @@ ansible_tower:
97100
body: {% raw %}"{{ offboard_1.body }}"{% endraw %}
98101
title: {% raw %}"{{ offboard_1.title }}"{% endraw %}
99102
list_of_users: {% raw %}"{{ full.list_of_users | default([]) }}"{% endraw %}
103+
list_of_mail_cc: {% raw %}"{{ list_of_mail_cc | default([]) }}"{% endraw %}
100104
- name: "{{ customer_engagement }}-offboard-2"
101105
description: "Offboard 2"
102106
{% raw -%}
@@ -108,6 +112,7 @@ ansible_tower:
108112
body: {% raw %}"{{ offboard_2.body }}"{% endraw %}
109113
title: {% raw %}"{{ offboard_2.title }}"{% endraw %}
110114
list_of_users: {% raw %}"{{ full.list_of_users | default([]) }}"{% endraw %}
115+
list_of_mail_cc: {% raw %}"{{ list_of_mail_cc | default([]) }}"{% endraw %}
111116
- name: "{{ customer_engagement }}-offboard-3"
112117
description: "Offboard 3"
113118
{% raw -%}
@@ -119,6 +124,7 @@ ansible_tower:
119124
body: {% raw %}"{{ offboard_3.body }}"{% endraw %}
120125
title: {% raw %}"{{ offboard_3.title }}"{% endraw %}
121126
list_of_users: {% raw %}"{{ full.list_of_users | default([]) }}"{% endraw %}
127+
list_of_mail_cc: {% raw %}"{{ list_of_mail_cc | default([]) }}"{% endraw %}
122128
- name: "{{ customer_engagement }}-shutoff"
123129
description: "Shutoff e-mail for the {{ customer_engagement }} engagement"
124130
{% raw -%}
@@ -130,3 +136,4 @@ ansible_tower:
130136
body: {% raw %}"{{ shutoff.body }}"{% endraw %}
131137
title: {% raw %}"{{ shutoff.title }}"{% endraw %}
132138
list_of_users: {% raw %}"{{ full.list_of_users | default([]) }}"{% endraw %}
139+
list_of_mail_cc: {% raw %}"{{ list_of_mail_cc | default([]) }}"{% endraw %}

0 commit comments

Comments
 (0)