@@ -30,8 +30,20 @@ def _getToolchainLink() -> str:
3030 return toolchainLink
3131 return ""
3232
33+ def _broadcast (channels : str , message : list ):
34+ channelList = [ch .strip () for ch in channels .split ("," )]
35+ responses = []
36+ for channel in channelList :
37+ try :
38+ response = SlackUtil .postMessageBlocks (channel , message )
39+ responses .append (response .data .get ("ok" , False ))
40+ except Exception as e :
41+ print (f"Failed to send message to channel { channel } : { e } " )
42+ responses .append (False )
43+ return all (responses ) if responses else True
44+
3345
34- def notifyProvisionFyre (channel : str , rc : int ) -> bool :
46+ def notifyProvisionFyre (channels : str , rc : int ) -> bool :
3547 """Send Slack notification about Fyre OCP cluster provisioning status."""
3648 name = _getClusterName ()
3749 toolchainLink = _getToolchainLink ()
@@ -57,11 +69,10 @@ def notifyProvisionFyre(channel: str, rc: int) -> bool:
5769 SlackUtil .buildSection (f"<https://beta.fyre.ibm.com/development/vms|Fyre Dashboard>{ toolchainLink } " )
5870 ]
5971
60- response = SlackUtil .postMessageBlocks (channel , message )
61- return response .data .get ("ok" , False )
72+ return _broadcast (channels , message )
6273
6374
64- def notifyProvisionRoks (channel : str , rc : int , additionalDetails : str = "" ) -> bool :
75+ def notifyProvisionRoks (channels : str , rc : int , additionalDetails : str = "" ) -> bool :
6576 """Send Slack notification about ROKS cluster provisioning status."""
6677 name = _getClusterName ()
6778 toolchainLink = _getToolchainLink ()
@@ -85,8 +96,7 @@ def notifyProvisionRoks(channel: str, rc: int, additionalDetails: str = "") -> b
8596 SlackUtil .buildSection (f"<https://cloud.ibm.com/kubernetes/clusters|IBM Cloud Dashboard>{ toolchainLink } " )
8697 ]
8798
88- response = SlackUtil .postMessageBlocks (channel , message )
89- return response .data .get ("ok" , False )
99+ return _broadcast (channels , message )
90100
91101
92102if __name__ == "__main__" :
0 commit comments