aboutsummaryrefslogtreecommitdiff
path: root/modules/role/files
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-09 19:37:20 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-09 20:24:55 +0100
commitbd263a98d542207c07b27dfb891e62b9e2c73c3d (patch)
treebdd9c78db130429d1aea769cbd8bfb93a7904aac /modules/role/files
parent764515b85346b43aa1268f5e86b99653f7dcccb0 (diff)
downloadPuppet-bd263a98d542207c07b27dfb891e62b9e2c73c3d.tar.gz
Puppet-bd263a98d542207c07b27dfb891e62b9e2c73c3d.tar.zst
Puppet-bd263a98d542207c07b27dfb891e62b9e2c73c3d.zip
Change deploy script
Diffstat (limited to 'modules/role/files')
-rw-r--r--modules/role/files/cryptoportfolio/slack-notify.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/modules/role/files/cryptoportfolio/slack-notify.py b/modules/role/files/cryptoportfolio/slack-notify.py
index fe64fb6..dfced46 100644
--- a/modules/role/files/cryptoportfolio/slack-notify.py
+++ b/modules/role/files/cryptoportfolio/slack-notify.py
@@ -1,12 +1,18 @@
1#!/usr/bin/env python3 1#!/usr/bin/env python3
2 2
3import os
3import sys 4import sys
4import json 5import json
5import urllib3 6import urllib3
6 7
7project = sys.argv[1] 8project = os.environ["P_PROJECT"]
8url = sys.argv[2] 9url = os.environ["P_WEBHOOK"]
9version = sys.argv[3] 10version = os.environ["P_VERSION"]
11host = os.environ["P_HOST"]
12if os.environ["P_HTTPS"] == "true":
13 scheme = "https://"
14else:
15 scheme = "http://"
10 16
11def post(url, data): 17def post(url, data):
12 urllib3.disable_warnings() 18 urllib3.disable_warnings()
@@ -20,7 +26,12 @@ def post(url, data):
20 26
21data = { 27data = {
22 "icon_url": "https://learn.puppet.com/static/images/logos/Puppet-Logo-Mark-Amber.png", 28 "icon_url": "https://learn.puppet.com/static/images/logos/Puppet-Logo-Mark-Amber.png",
23 "text": "Deployed {} on {}".format(version, project), 29 "text": "Deployed {} of {} on {}{}".format(
30 version,
31 project,
32 scheme,
33 host,
34 ),
24 } 35 }
25 36
26json_data = json.dumps(data) 37json_data = json.dumps(data)