From b4053b67d183d9980240b13788c609e816f44958 Mon Sep 17 00:00:00 2001 From: Mahemoff Date: Wed, 19 Mar 2014 09:55:49 +0000 Subject: [PATCH 1/3] Make hipchat "notify" flag optional (default off) --- plugins/callbacks/hipchat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/callbacks/hipchat.py b/plugins/callbacks/hipchat.py index ee4aca6aa3..a7bfdb6ec1 100644 --- a/plugins/callbacks/hipchat.py +++ b/plugins/callbacks/hipchat.py @@ -36,6 +36,7 @@ class CallbackModule(object): HIPCHAT_TOKEN (required): HipChat API token HIPCHAT_ROOM (optional): HipChat room to post in. Default: ansible HIPCHAT_FROM (optional): Name to post as. Default: ansible + HIPCHAT_NOTIFY (optional): Add notify flag to important messages ("true" or "false"). Default: false Requires: prettytable @@ -52,6 +53,7 @@ class CallbackModule(object): self.token = os.getenv('HIPCHAT_TOKEN') self.room = os.getenv('HIPCHAT_ROOM', 'ansible') self.from_name = os.getenv('HIPCHAT_FROM', 'ansible') + self.allow_notify = (os.getenv('HIPCHAT_NOTIFY') == 'true') if self.token is None: self.disabled = True @@ -71,7 +73,7 @@ class CallbackModule(object): params['message'] = msg params['message_format'] = msg_format params['color'] = color - params['notify'] = int(notify) + params['notify'] = int(self.allow_notify and notify) url = ('%s?auth_token=%s' % (self.msg_uri, self.token)) try: From 989913bc21f3e1aec7fb1076c527d19cc3244c54 Mon Sep 17 00:00:00 2001 From: Mahemoff Date: Wed, 19 Mar 2014 18:08:30 +0000 Subject: [PATCH 2/3] Change hipchat notification default to true --- plugins/callbacks/hipchat.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/callbacks/hipchat.py b/plugins/callbacks/hipchat.py index a7bfdb6ec1..09e8342a44 100644 --- a/plugins/callbacks/hipchat.py +++ b/plugins/callbacks/hipchat.py @@ -36,7 +36,7 @@ class CallbackModule(object): HIPCHAT_TOKEN (required): HipChat API token HIPCHAT_ROOM (optional): HipChat room to post in. Default: ansible HIPCHAT_FROM (optional): Name to post as. Default: ansible - HIPCHAT_NOTIFY (optional): Add notify flag to important messages ("true" or "false"). Default: false + HIPCHAT_NOTIFY (optional): Add notify flag to important messages ("true" or "false"). Default: true Requires: prettytable @@ -53,7 +53,8 @@ class CallbackModule(object): self.token = os.getenv('HIPCHAT_TOKEN') self.room = os.getenv('HIPCHAT_ROOM', 'ansible') self.from_name = os.getenv('HIPCHAT_FROM', 'ansible') - self.allow_notify = (os.getenv('HIPCHAT_NOTIFY') == 'true') + self.allow_notify = (os.getenv('HIPCHAT_NOTIFY') != 'false') + print(self.allow_notify) if self.token is None: self.disabled = True From 1640788f3046be3272bacfc289e91b433797f3a4 Mon Sep 17 00:00:00 2001 From: Mahemoff Date: Wed, 19 Mar 2014 18:15:20 +0000 Subject: [PATCH 3/3] Remove debugging line (hipchat notification) --- plugins/callbacks/hipchat.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/callbacks/hipchat.py b/plugins/callbacks/hipchat.py index 09e8342a44..a5acf9194e 100644 --- a/plugins/callbacks/hipchat.py +++ b/plugins/callbacks/hipchat.py @@ -54,7 +54,6 @@ class CallbackModule(object): self.room = os.getenv('HIPCHAT_ROOM', 'ansible') self.from_name = os.getenv('HIPCHAT_FROM', 'ansible') self.allow_notify = (os.getenv('HIPCHAT_NOTIFY') != 'false') - print(self.allow_notify) if self.token is None: self.disabled = True