#!/bin/ksh93 # ALTRAN_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # Copyright (C) Altran ACT S.A.S. 2017,2018,2019,2021. All rights reserved. # # ALTRAN_PROLOG_END_TAG # # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r721 src/43haes/lib/ksh93/hacmp/KLIB_HACMP_is_known_event.sh 1.3 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2012,2016 # 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 # @(#) 7d4c34b 43haes/lib/ksh93/hacmp/KLIB_HACMP_is_known_event.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM # Start of POD-formatted documentation. Viewing suggestions: # perldoc # pod2text -c # pod2text -c --code # pod2html function devDoc { : <<'=cut' >/dev/null 2>&1 =head1 NAME KLIB_HACMP_is_known_event =head1 SYNOPSIS KLIB_HACMP_is_known_event =head1 DESCRIPTION Determines if the specified event is configured within the cluster. =head1 ARGUMENTS 1. event [REQUIRED] [string] The name of the event to search for on this node. 2. type [OPTIONAL] [set] The type of the event: ALL, CUSTOM, PREDEFINED =head1 RETURN 0: no errors were detected; the operation appears to have been successful 1: a general error has occurred 2: a specified resource does not exist, or could not be found 3: some required input was missing 4: some detected input was incorrect in some way 5: a required dependency does not exist 6: a specified search failed to match any data =cut } # End of POD-formatted documentation. function KLIB_HACMP_is_known_event { LINENO=2 . $HALIBROOT/log_entry "$0()" "$CL" : INPUTS: $* typeset event=${1//\"/} typeset -u type=${2//\"/} if [[ -n $3 ]]; then typeset -n DISCOVERED_TYPE=$3 DISCOVERED_TYPE="" fi [[ $CLMGR_LOGGING == 'med' ]] && set +x # Only trace param values #=================================== : Declare and initialize variables #=================================== typeset -i rc=$RC_UNKNOWN typeset -A list typeset LINE= #================= : Validate input #================= if [[ -z $event ]]; then /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 100 "\nERROR: a name/label must be provided.\n\n" 1>&2 rc=$RC_MISSING_INPUT else if [[ $type == *([[:space:]]) || $type == @(\*|A|C)* ]]; then print -- "$0()[$LINENO]($SECONDS): $HAUTILS/cllscustom -t event -n $event" >>$CLMGR_TMPLOG if [[ $($HAUTILS/cllscustom -t event -n $event | /usr/bin/grep -v '^#') != *([[:space:]]) ]] then rc=$RC_SUCCESS [[ -n $3 ]] && DISCOVERED_TYPE="CUSTOM" print -- "$0()[$LINENO]($SECONDS): cllscustom RC: $rc" >>$CLMGR_TMPLOG else print -- "$0()[$LINENO]($SECONDS): cllscustom RC: $RC_NOT_FOUND" >>$CLMGR_TMPLOG fi fi if (( $rc != RC_SUCCESS )) || [[ $type == @(\*|A|P)* ]]; then print -- "$0()[$LINENO]($SECONDS): clodmget -q\"name = $event\" -f name -n HACMPevent" >>$CLMGR_TMPLOG OUTPUT=$(clodmget -q"name = $event" -f name -n HACMPevent 2>>CLMGR_TMPLOG) rc=$? print -- "$0()[$LINENO]($SECONDS): clodmget RC: $rc" >>$CLMGR_TMPLOG if [[ -n $OUTPUT ]] then rc=$RC_SUCCESS if [[ -n $3 ]]; then if [[ -n $DISCOVERED_TYPE ]]; then DISCOVERED_TYPE="ALL" else DISCOVERED_TYPE="PREDEFINED" fi fi else rc=$RC_NOT_FOUND fi fi fi log_return_msg "$rc" "$0()" "$LINENO" return $? } # End of "KLIB_HACMP_is_known_event()"