#!/bin/sh

cat<<EOS
### WARNING ################################################################
# This command has been deprecated and will be removed in a future release.
# Use "riak-cs-supercluster <subcommand>" instead of this.
############################################################################
EOS

# Pull environment for this install
. "/usr/local/lib/riak-cs/lib/env.sh"

# Make sure the user running this script is the owner and/or su to that user
check_user $@

# Make sure CWD is set to runner run dir
cd $RUNNER_BASE_DIR

# Identify the script name
SCRIPT=`basename $0`

# Check the first argument for instructions
case "$1" in
    list-members|weight|weight-manifest|weight-block|refresh)
        # Make sure the local node IS running
        node_up_check

        $NODETOOL rpc riak_cs_multibag_console "$@"
        ;;
    list-bags)
        node_up_check
        $NODETOOL rpc riak_cs_multibag_console list-members
        ;;
    *)
        echo "Usage: $SCRIPT { list-members |  weight | weight-manifest | weight-block | refresh | list-bags }"
        exit 1
        ;;
esac
