2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Merge pull request #788 from xuweibj/I784

To fix issue #784, output error message when use rcons node -f -s
This commit is contained in:
Xiaopeng Wang 2016-03-15 14:13:41 +08:00
commit 66a761c9a7

View File

@ -28,28 +28,35 @@ if [ "$1" = "-v" -o "$1" = "--version" ]; then
exit 0
fi
if [ -n "$3" ] && [ "$3" = "-f" ]; then
FORCE=-f
CONSERVER=$2
fi
param_n=0
for parameter in $@; do
((param_n++))
#console spy mode
if [ -n "$3" ] && [ "$3" = "-s" ]; then
FORCE=-s
CONSERVER=$2
fi
if [ -n "$2" ]; then
if [ "$2" = "-f" ]; then
FORCE=-f
else
if [ "$2" = "-s" ]; then
FORCE=-s
else
CONSERVER=$2
fi
# check the second parameter to be conserver
if [ $param_n -eq 2 ]; then
if [ "$parameter" != "-f" ] && [ "$parameter" != "-s" ]; then
CONSERVER=$parameter
fi
fi
fi
if [ $param_n -ge 2 ]; then
if [ "$parameter" = "-f" ] || [ "$parameter" = "-s" ]; then
if [ -z "$FORCE" ]; then
FORCE=$parameter
elif [ "$FORCE" != "$parameter" ]; then
echo "Error: cannot use option -s and -f together."
exit 1
fi
fi
fi
if [ $param_n -ge 3 ]; then
if [ "$parameter" != "-f" ] && [ "$parameter" != "-s" ]; then
echo "Error: cannot recognize parameter \"$parameter\"."
exit 1
fi
fi
done
# xCAT 2.9.1 allows for an option to use confluent as a rcons replacement and only use
# confluent if this keyword is defined in the site table. This allows for confluent to