Skip to content
Permalink
Browse files

Notification sms: stop if pager is not set

the sms notifcation script logs "Text: No text, stopping." when no pager address is set. Also the notification would be spooled again.
cause this message isnt very helpful, we better catch this error and print better message

Fixes #9

Change-Id: Id11f795f5cdab92d85871a0cdc6971d3763e61fd
  • Loading branch information...
m4c3 authored and 7omb committed May 14, 2019
1 parent 35361db commit 8e744839827dc3c66b40f1bce573e244fe291f06
Showing with 6 additions and 2 deletions.
  1. +6 −2 notifications/sms
@@ -49,6 +49,12 @@ if not send_path and not spool_dir:
'Error: SMS Tools binaries (sendsms or smssend) not found and spool dir does not exists.\n')
sys.exit(2) # Fatal error, no retry

recipient = os.environ['NOTIFY_CONTACTPAGER'].replace(" ", "")
if not recipient:
contactname = os.environ['NOTIFY_CONTACTNAME']
sys.stderr.write('Error: Pager Number of %s not set\n' % contactname)
sys.exit(2) # Fatal error, no retry

max_len = 160
message = os.environ['NOTIFY_HOSTNAME'] + " "

@@ -89,8 +95,6 @@ elif notification_type == "CUSTOM":
message += " Custom Notification"
message += " " + os.environ['NOTIFY_NOTIFICATIONCOMMENT']

recipient = os.environ['NOTIFY_CONTACTPAGER'].replace(" ", "")


def quote_message(msg, max_length=None):
if max_length:

0 comments on commit 8e74483

Please sign in to comment.
You can’t perform that action at this time.