#!/bin/bash
# Cluster-wide event notification.
# The following environment variables are provided by the caller:
# EVENT_ID - unique identifier of the event
# EVENT - name of the cluster-wide event
# SRC_NODE_ID - node identifier
# SRC_NODE_IP - node IP address

. /usr/share/shaman/functions

verify_caller

if [ -z "$EVENT" ]; then
	echo "EVENT environment variable undefined" 1>&2
	exit 1
fi

case "$EVENT" in
	NODE_CRASH)
# node $SRC_NODE_ID crashed
		;;
	NODE_JOIN)
# node $SRC_NODE_ID had been registered in the cluster
		;;
	NODE_LEAVE)
# node $SRC_NODE_ID had been unregistered from the cluster
		;;
	*)
		echo "Unknown event $EVENT" 1>&2
		exit 2
		;;
esac

exit 0
