Skip to content

Commit

Permalink
Add very basic support for email header, footer
Browse files Browse the repository at this point in the history
- Add EMAIL_HEADER, EMAIL_FOOTER conf file options
- Add example conf file to illustrate currently supported
  options. Future supported options should be added to
  the file to showcase their use.

refs WhyAskWhy#5
  • Loading branch information
deoren committed Apr 9, 2018
1 parent a44a6ea commit 1819ce8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions email_updates.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Example include file for the email_updates.sh script

DEBUG_ON=0
EMAIL_TAG_PROJECT="servers-general"
EMAIL_TAG_CATEGORY="OS Patches"
EMAIL_DEST="[email protected]"

EMAIL_HEADER="The following updates are available for installation:"
EMAIL_FOOTER="{{include(docs:How_to_apply_patches_to_our_systems)}}"
6 changes: 6 additions & 0 deletions email_updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ email_report() {
NUMBER_OF_UPDATES="${#updates[@]}"
EMAIL_SUBJECT="${HOSTNAME}: ${NUMBER_OF_UPDATES} update(s) are available"

# TODO: Add guard for this variable not existing (new feature as of v0.3)
echo -e "${EMAIL_HEADER}\n" >> ${TEMP_FILE}

# Write updates to the temp file
for update in "${updates[@]}"
do
Expand All @@ -389,6 +392,9 @@ email_report() {

fi

# TODO: Add guard for this variable not existing (new feature as of v0.3)
echo -e "\n${EMAIL_FOOTER}\n" >> ${TEMP_FILE}

# Send the report via email
# If user chose to masquerade this email as a specific user, set the value
if [[ ! -z ${EMAIL_SENDER} ]]; then
Expand Down

0 comments on commit 1819ce8

Please sign in to comment.