aboutsummaryrefslogtreecommitdiff
path: root/modules/role/files
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-05 17:29:29 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-05 17:36:54 +0100
commita4c92ff7477d09b480cab028411bc7c6b250604e (patch)
tree5a8394a64cf4a1d3fb9ffcdb3c8ed3328b94fb79 /modules/role/files
parentd765eedf28199f6723dee5dab7c81a357be86f72 (diff)
downloadPuppet-a4c92ff7477d09b480cab028411bc7c6b250604e.tar.gz
Puppet-a4c92ff7477d09b480cab028411bc7c6b250604e.tar.zst
Puppet-a4c92ff7477d09b480cab028411bc7c6b250604e.zip
Add notification for app deployment
Diffstat (limited to 'modules/role/files')
-rw-r--r--modules/role/files/cryptoportfolio/slack-notify.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/role/files/cryptoportfolio/slack-notify.py b/modules/role/files/cryptoportfolio/slack-notify.py
new file mode 100644
index 0000000..fe64fb6
--- /dev/null
+++ b/modules/role/files/cryptoportfolio/slack-notify.py
@@ -0,0 +1,27 @@
1#!/usr/bin/env python3
2
3import sys
4import json
5import urllib3
6
7project = sys.argv[1]
8url = sys.argv[2]
9version = sys.argv[3]
10
11def post(url, data):
12 urllib3.disable_warnings()
13 http = urllib3.PoolManager()
14
15 encoded = data.encode('utf-8')
16
17 r = http.request("POST", url,
18 headers={'Content-Type': 'application/json'},
19 body=encoded)
20
21data = {
22 "icon_url": "https://learn.puppet.com/static/images/logos/Puppet-Logo-Mark-Amber.png",
23 "text": "Deployed {} on {}".format(version, project),
24 }
25
26json_data = json.dumps(data)
27post(url, json_data)