@@ -15,13 +15,15 @@ import os
1515import sys
1616from mas .devops .slack import SlackUtil
1717
18+
1819def _getClusterName () -> str :
1920 name = os .getenv ("CLUSTER_NAME" , "" )
2021 if name == "" :
2122 print ("CLUSTER_NAME env var must be set" )
2223 sys .exit (1 )
2324 return name
2425
26+
2527def _getToolchainLink () -> str :
2628 toolchainUrl = os .getenv ("TOOLCHAIN_PIPELINERUN_URL" , None )
2729 toolchainTriggerName = os .getenv ("TOOLCHAIN_TRIGGER_NAME" , None )
@@ -31,7 +33,7 @@ def _getToolchainLink() -> str:
3133 return ""
3234
3335
34- def notifyProvisionFyre (channels : list [str ], rc : int , additionalMsg : str = "" ) -> bool :
36+ def notifyProvisionFyre (channels : list [str ], rc : int , additionalMsg : str = None ) -> bool :
3537 """Send Slack notification about Fyre OCP cluster provisioning status."""
3638 name = _getClusterName ()
3739 toolchainLink = _getToolchainLink ()
@@ -51,7 +53,7 @@ def notifyProvisionFyre(channels: list[str], rc: int, additionalMsg: str = "") -
5153 SlackUtil .buildSection (f"- Username: `{ username } `\n - Password: `{ password } `" ),
5254 SlackUtil .buildSection (f"<https://beta.fyre.ibm.com/development/vms|Fyre Dashboard>{ toolchainLink } " )
5355 ]
54- if additionalMsg :
56+ if additionalMsg is not None :
5557 message .append (SlackUtil .buildSection (additionalMsg ))
5658 else :
5759 message = [
@@ -65,7 +67,7 @@ def notifyProvisionFyre(channels: list[str], rc: int, additionalMsg: str = "") -
6567 return response .data .get ("ok" , False )
6668
6769
68- def notifyProvisionRoks (channels : list [str ], rc : int , additionalMsg : str = "" ) -> bool :
70+ def notifyProvisionRoks (channels : list [str ], rc : int , additionalMsg : str = None ) -> bool :
6971 """Send Slack notification about ROKS cluster provisioning status."""
7072 name = _getClusterName ()
7173 toolchainLink = _getToolchainLink ()
@@ -81,7 +83,7 @@ def notifyProvisionRoks(channels: list[str], rc: int, additionalMsg: str = "") -
8183 SlackUtil .buildSection (f"{ url } " ),
8284 SlackUtil .buildSection (f"<https://cloud.ibm.com/kubernetes/clusters|IBM Cloud Dashboard>{ toolchainLink } " )
8385 ]
84- if additionalMsg :
86+ if additionalMsg is not None :
8587 message .append (SlackUtil .buildSection (additionalMsg ))
8688 else :
8789 message = [
@@ -111,7 +113,7 @@ if __name__ == "__main__":
111113 # Primary Options
112114 parser .add_argument ("--action" , required = True )
113115 parser .add_argument ("--rc" , required = True , type = int )
114- parser .add_argument ("--msg" , required = False , default = "" )
116+ parser .add_argument ("--msg" , required = False , default = None )
115117
116118 args , unknown = parser .parse_known_args ()
117119
0 commit comments