diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-09 19:37:20 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-09 20:24:55 +0100 |
commit | bd263a98d542207c07b27dfb891e62b9e2c73c3d (patch) | |
tree | bdd9c78db130429d1aea769cbd8bfb93a7904aac /modules/role/files | |
parent | 764515b85346b43aa1268f5e86b99653f7dcccb0 (diff) | |
download | Puppet-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.py | 19 |
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 | ||
3 | import os | ||
3 | import sys | 4 | import sys |
4 | import json | 5 | import json |
5 | import urllib3 | 6 | import urllib3 |
6 | 7 | ||
7 | project = sys.argv[1] | 8 | project = os.environ["P_PROJECT"] |
8 | url = sys.argv[2] | 9 | url = os.environ["P_WEBHOOK"] |
9 | version = sys.argv[3] | 10 | version = os.environ["P_VERSION"] |
11 | host = os.environ["P_HOST"] | ||
12 | if os.environ["P_HTTPS"] == "true": | ||
13 | scheme = "https://" | ||
14 | else: | ||
15 | scheme = "http://" | ||
10 | 16 | ||
11 | def post(url, data): | 17 | def post(url, data): |
12 | urllib3.disable_warnings() | 18 | urllib3.disable_warnings() |
@@ -20,7 +26,12 @@ def post(url, data): | |||
20 | 26 | ||
21 | data = { | 27 | data = { |
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 | ||
26 | json_data = json.dumps(data) | 37 | json_data = json.dumps(data) |