Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors reported by drac5 external stonith plugin #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions lib/plugins/stonith/external/drac5.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,45 @@
# License: GNU General Public License (GPL)
#

trap 'if [ -n "$outf" ]; then ha_log.sh err "`cat $outf`"; rm -f "$outf"; fi' 0
tabraham marked this conversation as resolved.
Show resolved Hide resolved
outf=`mktemp` || {
ha_log.sh err "mktemp failed"
exit 1
ha_log() {
severity=$1
outfile=$2
if [ -n "$outfile" ]
then
if [ -s "$outfile" ]
then
ha_log.sh "$severity" "`cat $outfile`"
fi
fi
}

cleanup () {
if [ -e "$outf" ]
then
rm -r "$outf"
fi
}

sshlogin() {
outf=`mktemp` || {
ha_log.sh err "mktemp failed"
return 1
}

if [ x = "x$ipaddr" -o x = "x$userid" ]
then
ha_log.sh err "ipaddr or userid missing; check configuration"
return 1
fi
@SSH@ -q -x -n $userid@$ipaddr racadm serveraction "$1" >$outf 2>&1
if [ $? -ne 0 ]
then
ha_log err "$outf"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function should return the racadm's exit code, i.e. if it reports an error then the action failed (I'd assume). Note that the following call to cleanup will effectively clear the exit code, so you have to save it.

else
ha_log debug "$outf"
fi

cleanup
}

drac_reset() {
Expand Down