#!/bin/bash

#       Copyright (c) Marathon Technologies Corporation, 2008.
#       All Rights Reserved. Unpublished rights reserved
#       under the copyright laws of the United States.
# 
#       The software contained on this media is proprietary
#       to and embodies the confidential technology of
#       Marathon Technologies Corporation. Possession, use,
#       duplication or dissemination of the software and
#       media is authorized only pursuant to a valid written
#       license from Marathon Technologies Corporation.
# 
#       RESTRICTED RIGHTS LEGEND Use, duplication, or
#       disclosure by the U.S. Government is subject to
#       restrictions as set forth in Subparagraph (c)(1)(ii)
#       of DFARS 252.227-7013, or in FAR 52.227-19, as
#       applicable.

. /opt/xensource/xha/ha_rc

#
#   ha_clear_excluded [-C <config-file-name>]
#

# get config-file name

cf=`getcf $*` || exit $?

# attempt to clear excluded bit through the daemon

calldaemon clear_excluded
status=$?

# if the attempt failed because the daemon is not present,
# then we attempt to update the data on the State-File.

case $status in
    $MTC_EXIT_DAEMON_IS_NOT_PRESENT)
        # attempt to write directly to the host specific section
        writestatefile clearex $cf
        status=$?
        ;;
    *)
        ;;
esac

exit $status
