Skip to content

Commit 6f82a42

Browse files
committed
Update mas-devops-notify-slack
1 parent e92dc0f commit 6f82a42

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

bin/mas-devops-notify-slack

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import sys
1616
from mas.devops.slack import SlackUtil
1717

1818

19-
def notifyProvisionFyre(rc: int) -> bool:
19+
def notifyProvisionFyre(channel: str, rc: int) -> bool:
2020
name = os.getenv("CLUSTER_NAME", None)
2121
if name is None:
2222
print("CLUSTER_NAME env var must be set")
@@ -42,15 +42,16 @@ def notifyProvisionFyre(rc: int) -> bool:
4242
SlackUtil.buildSection("https://beta.fyre.ibm.com/development/vms")
4343
]
4444

45-
response = SlackUtil.postMessageBlocks("#bot-test", message)
45+
response = SlackUtil.postMessageBlocks(channel, message)
4646

4747
return response.data.get("ok", False)
4848

4949

5050
if __name__ == "__main__":
51-
# If SLACK_TOKEN env var is not set then silently exit taking no action
51+
# If SLACK_TOKEN or SLACK_CHANNEL env vars are not set then silently exit taking no action
5252
SLACK_TOKEN = os.getenv("SLACK_TOKEN", None)
53-
if SLACK_TOKEN is None:
53+
SLACK_CHANNEL = os.getenv("SLACK_CHANNEL", None)
54+
if SLACK_TOKEN is None or SLACK_CHANNEL is None:
5455
sys.exit(0)
5556

5657
# Initialize the properties we need
@@ -62,4 +63,4 @@ if __name__ == "__main__":
6263
args, unknown = parser.parse_known_args()
6364

6465
if args.action == "ocp-provision-fyre":
65-
notifyProvisionFyre(args.rc)
66+
notifyProvisionFyre(SLACK_CHANNEL, args.rc)

0 commit comments

Comments
 (0)