Skip to content

Commit

Permalink
fix: post cluster setup script err message send
Browse files Browse the repository at this point in the history
  • Loading branch information
assafgi committed Jan 30, 2025
1 parent 2d23d3f commit db58d92
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions clusterize/clusterize.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,19 @@ func (c *ClusterizeScriptGenerator) GetClusterizeScript() string {
report "{\"hostname\": \"$HOSTNAME\", \"type\": \"progress\", \"message\": \"Skipping OBS setup\"}"
fi
function post_cluster_setup() {
post_cluster_setup_script="%s"
if [ -n "$post_cluster_setup_script" ]; then
report "{\"hostname\": \"$HOSTNAME\", \"type\": \"progress\", \"message\": \"Running post cluster setup script\"}"
post_cluster_setup_script_path=/tmp/weka_post_cluster_setup_script.sh
echo "$post_cluster_setup_script" > "$post_cluster_setup_script_path"
chmod +x "$post_cluster_setup_script_path"
echo "running post clusterization script"
%s
}
post_cluster_setup || report "{\"hostname\": \"$HOSTNAME\", \"type\": \"error\", \"message\": \"Failed running post cluster setup script\"}"
if "$post_cluster_setup_script_path"; then
report "{\"hostname\": \"$HOSTNAME\", \"type\": \"progress\", \"message\": \"Running post cluster setup script completed successfully\"}"
else
report "{\"hostname\": \"$HOSTNAME\", \"type\": \"error\", \"message\": \"Running post cluster setup script failed\"}"
fi
fi
`
script := fmt.Sprintf(
dedent.Dedent(clusterizeScriptTemplate),
Expand Down

0 comments on commit db58d92

Please sign in to comment.