From bd263a98d542207c07b27dfb891e62b9e2c73c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 9 Mar 2018 19:37:20 +0100 Subject: Change deploy script --- modules/role/files/cryptoportfolio/slack-notify.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'modules/role/files/cryptoportfolio') 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 @@ #!/usr/bin/env python3 +import os import sys import json import urllib3 -project = sys.argv[1] -url = sys.argv[2] -version = sys.argv[3] +project = os.environ["P_PROJECT"] +url = os.environ["P_WEBHOOK"] +version = os.environ["P_VERSION"] +host = os.environ["P_HOST"] +if os.environ["P_HTTPS"] == "true": + scheme = "https://" +else: + scheme = "http://" def post(url, data): urllib3.disable_warnings() @@ -20,7 +26,12 @@ def post(url, data): data = { "icon_url": "https://learn.puppet.com/static/images/logos/Puppet-Logo-Mark-Amber.png", - "text": "Deployed {} on {}".format(version, project), + "text": "Deployed {} of {} on {}{}".format( + version, + project, + scheme, + host, + ), } json_data = json.dumps(data) -- cgit v1.2.3