From 513eadbd9289c013127b562a61274f56a768edd4 Mon Sep 17 00:00:00 2001 From: Toby Evans Date: Fri, 7 Nov 2014 10:09:26 +1300 Subject: [PATCH] Update the webhook url This change fixes the 404 seen with the current version. fixes #100 --- notification/slack.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/notification/slack.py b/notification/slack.py index 176d6b338fb..5577228978b 100644 --- a/notification/slack.py +++ b/notification/slack.py @@ -105,8 +105,7 @@ EXAMPLES = """ """ - -SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s' +SLACK_INCOMING_WEBHOOK = 'https://hooks.slack.com/services/%s' def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse): payload = dict(text=text) @@ -128,11 +127,11 @@ def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoj return payload def do_notify_slack(module, domain, token, payload): - slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, token) + slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (token) response, info = fetch_url(module, slack_incoming_webhook, data=payload) if info['status'] != 200: - obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, '[obscured]') + obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % ('[obscured]') module.fail_json(msg=" failed to send %s to %s: %s" % (payload, obscured_incoming_webhook, info['msg'])) def main(): @@ -170,4 +169,4 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.urls import * -main() \ No newline at end of file +main()