Fix too-long subjects sent by git and nagios integrations
(imported from commit 9bf3af613b07fb7c72125eee0d08fd4a16dfa88a)
This commit is contained in:
parent
be7903443c
commit
d68f365ee5
|
@ -76,7 +76,7 @@ def git_commit_range(oldrev, newrev):
|
||||||
for ln in subprocess.check_output(log_cmd).splitlines():
|
for ln in subprocess.check_output(log_cmd).splitlines():
|
||||||
email, subject = ln.split(None, 1)
|
email, subject = ln.split(None, 1)
|
||||||
if len(subject) > 60:
|
if len(subject) > 60:
|
||||||
subject = subject[:58].rstrip() + '...'
|
subject = subject[:57].rstrip() + '...'
|
||||||
commits += '!gravatar(%s) %s\n' % (email, subject)
|
commits += '!gravatar(%s) %s\n' % (email, subject)
|
||||||
return commits
|
return commits
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ else:
|
||||||
thing = 'service'
|
thing = 'service'
|
||||||
msg['subject'] = 'service %s on %s' % (opts.service, opts.host)
|
msg['subject'] = 'service %s on %s' % (opts.service, opts.host)
|
||||||
|
|
||||||
|
if len(msg['subject']) > 60:
|
||||||
|
msg['subject'] = msg['subject'][0:57].rstrip() + "..."
|
||||||
# e.g. **PROBLEM**: service is CRITICAL
|
# e.g. **PROBLEM**: service is CRITICAL
|
||||||
msg['content'] = '**%s**: %s is %s' % (opts.type, thing, opts.state)
|
msg['content'] = '**%s**: %s is %s' % (opts.type, thing, opts.state)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue