#!/bin/bash

# Creates a thread dump of the application
# NOTE: This abstract hook is intended to notify users this feature is not
#       yet supported.  This can and probably should be removed once we have
#       complete coverage of the threaddump command on all app types.

# Exit on any errors
set -e

function print_help {
    echo "Usage: $0 app-name namespace uuid"
    echo "Get a thread dump for a running application"

    echo "$0 $@" | logger -p local0.notice -t openshift_origin_threaddump
    exit 1
}

while getopts 'd' OPTION
do
    case $OPTION in
        d) set -x
        ;;
        ?) print_help
        ;;
    esac
done

[ $# -eq 3 ] || print_help

source "/etc/openshift/node.conf"
source ${CARTRIDGE_BASE_PATH}/abstract/info/lib/util

setup_basic_hook "$1" $2 $3

#
# Print a notice that this command is not supported
#

client_error "The threaddump command is not supported by this application type."
