#!/bin/ksh
## IBM_PROLOG_BEGIN_TAG 
## This is an automatically generated prolog. 
##  
##  
##  
## Licensed Materials - Property of IBM 
##  
## (C) COPYRIGHT International Business Machines Corp. 2010,2019 
## All Rights Reserved 
##  
## US Government Users Restricted Rights - Use, duplication or 
## disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
##  
## IBM_PROLOG_END_TAG 

# sccsid = "@(#)32   1.6   src/rsct/cfg_access/ctcaagetrsctinfo.sh, cfg.access, rsct_rady, rady2035a 1/11/16 16:35:27"

# Note - this will do the remote execution which may be an old node.
# So, PATH should include /usr/sbin/rsct/ too.
OLDRSCTPATH=/usr/sbin/rsct
export PATH=$PATH:/opt/rsct/bin:${OLDRSCTPATH}/bin:/usr/bin


#***************************************************************************=

function print_usage
{
        print "ctcaagetrsctinfo [-a] node1 [node2...]"
        print "options:"
        print "   -a    # get the detail node info"
}

#***************************************************************************=
# MAIN  ----------------------
FULLINFO=""
while getopts "ha" opt
do
    case $opt in
        a ) FULLINFO="-a"
            ;;

        ? ) print_usage
            exit 1
            ;;
    esac
done

#remove options
shift $(($OPTIND - 1))

# expects a clcmd-style '-m' node list as $1
# stderr still needs to be printed so that the caller can capture the stderr.
# Note - this will do the remote execution which may be an old node.
# So, ctcaagetnodeidandver - should be able to handle both old/new paths
exec /usr/sbin/clcmd -m $1  ctcaagetnodeidandver $FULLINFO | egrep -v '^-*$|NODE'