On Wed, Feb 16, 2011 at 12:45:48AM +0100, Michael Prokop wrote:
> Hi,
>
> agent's ocf-tester doesn't redirect error messages to stderr.
> The attached patch addresses this issue.
>
> regards,
> -mika-
> --
> http://michael-prokop.at/ || http://adminzen.org/
> http://grml-solutions.com/ || http://grml.org/
> # HG changeset patch
> # User Michael Prokop
> # Date 1297775920 -3600
> # Node ID a86054c616c67bdc36c86151a85587f114848951
> # Parent 17f68c9e93cb76a411c8bc0da8917596cee95a55
> ocf-tester: redirect error messages to stderr
>
> The --help option isn't handled in the command line parsing and
> therefore doesn't have the same option handling as the -h option.
> As a result do not mention the --help option in the usage information.
>
> diff -r 17f68c9e93cb -r a86054c616c6 tools/ocf-tester.in
> --- a/tools/ocf-tester.in Mon Feb 14 11:46:18 2011 +0100
> +++ b/tools/ocf-tester.in Tue Feb 15 14:18:40 2011 +0100
> @@ -37,15 +37,22 @@
> num_errors=0
>
> usage() {
> - echo "Tool for testing if a cluster resource is OCF compliant"
> - echo ""
> - echo "Usage: ocf-tester [-Lh] -n resource_name [-o name=value]*
> /full/path/to/resource/agent"
> - echo ""
> - echo "Options:"
> - echo " -h,--help This text"
> - echo " -n name Name of the resource"
> - echo " -o name=value Name and value of any parameters
> required by the agent"
> - echo " -L Use lrmadmin/lrmd for tests"
> + # make sure to output errors on stderr
> + if [ $1 -ne 0 ] ; then
> + usage_echo() { echo "$@" >&2 ; }
> + else
> + usage_echo() { echo "$@" ; }
> + fi
> +
> + usage_echo "Tool for testing if a cluster resource is OCF compliant"
> + usage_echo ""
> + usage_echo "Usage: ocf-tester [-Lh] -n resource_name [-o name=value]*
> /full/path/to/resource/agent"
> + usage_echo ""
> + usage_echo "Options:"
> + usage_echo " -h This text"
> + usage_echo " -n name Name of the resource"
> + usage_echo " -o name=value Name and value of any
> parameters required by the agent"
> + usage_echo " -L Use lrmadmin/lrmd for tests"
> exit $1
> }
hm.
how about
[ x$1 = x0 ] || exec >&2
leave echo ... in place as is
exit $1
--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/