Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
testing
puppet-icinga2_notificationtest
Commits
334b777f
Commit
334b777f
authored
Dec 08, 2016
by
Markus Frosch
Browse files
Test and fix log-notification.sh
parent
b5698e92
Pipeline
#179
passed with stage
in 32 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
templates/log-notification.sh.erb
View file @
334b777f
...
...
@@ -13,15 +13,23 @@ else
fi
wrap_nl() {
echo $(echo "$1" | sed 's/\n/\n /')
text="$1"
blank="$2"
if [ -z "$blank" ]; then
blank=" "
fi
echo "$(echo "$text" | sed "2~1s/^/$blank/g")"
}
output=$(wrap_nl "$OUTPUT")
if [ -n "$NOTIFICATIONAUTHORNAME" ]; then
output="$output\n Author: $NOTIFICATIONAUTHORNAME\n "$(wrap_nl "$NOTIFICATIONCOMMENT")
output+=`echo -e "\n Author: "`
output+="$NOTIFICATIONAUTHORNAME"
output+=`echo -e "\n Comment: "`
output+=$(wrap_nl "$NOTIFICATIONCOMMENT")
fi
printf "[%s] [%s] [%s] [%s] [%s] %s" \
printf "[%s] [%s] [%s] [%s] [%s] %s
\n
" \
"$DATE" "$USERNAME" "$OBJECT_NAME" "$NOTIFICATIONTYPE" "$STATE" "$output" \
>> "$LOGFILE"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment