Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
pacemaker.13547
pacemaker-tools-improve-crm_master-help-and-err...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-tools-improve-crm_master-help-and-error-messages.patch of Package pacemaker.13547
commit 10c67a049ede5b3b9572efb104fb7e77b3afcecb Author: Ken Gaillot <kgaillot@redhat.com> Date: Wed Jan 3 14:11:55 2018 -0600 Doc: tools: improve crm_master help and error messages Index: pacemaker-1.1.16+20170320.77ea74d/tools/crm_master =================================================================== --- pacemaker-1.1.16+20170320.77ea74d.orig/tools/crm_master +++ pacemaker-1.1.16+20170320.77ea74d/tools/crm_master @@ -2,13 +2,47 @@ target=`crm_node -n` +USAGE_TEXT="Usage: crm_master <command> [<options>] +Common options: + --help Display this text, then exit + --version Display version information, then exit + -V, --verbose Specify multiple times to increase debug output + -q, --quiet Print only the value (if querying) + +Commands: + -G, --query Query the current value of the master score + -v, --update=VALUE Update the value of the master score + -D, --delete Delete the master score + +Additional Options: + -N, --node=NODE Use master score on named node (instead of local node) + -l, --lifetime=VALUE Until when should the setting take effect + (valid values: reboot, forever) + -i, --id=VALUE (Advanced) XML ID used to identify master score attribute" + +HELP_TEXT="crm_master - Query, update, or delete a resource's promotion score + +This program should normally be invoked only from inside an OCF resource agent. + +$USAGE_TEXT" + +exit_usage() { + if [ $# -gt 0 ]; then + echo "error: $@" >&2 + fi + echo + echo "$USAGE_TEXT" + exit 1 +} + TEMP=`getopt -o qDGQVN:U:v:i:l:r: --long version,help,resource:,node:,uname:,attr-value:,id:,update:,delete-attr,get-value,attr-id:,lifetime:,quiet \ -n 'crm_master' -- "$@"` -if [ $? != 0 ] ; then echo "crm_master - A convenience wrapper for crm_attribute"; echo ""; crm_attribute -?; exit 1 ; fi +if [ $? -ne 0 ]; then + exit_usage +fi -# Note the quotes around `$TEMP': they are essential! -eval set -- "$TEMP" +eval set -- "$TEMP" # Quotes around $TEMP are essential while true ; do case "$1" in @@ -16,41 +50,28 @@ while true ; do -v|--attr-value|--update|-i|--id|--attr-id|-l|--lifetime) options="$options $1 $2"; shift; shift;; -Q|-q|--quiet|-D|--delete-attr|-G|--get-value|-V) options="$options $1"; shift;; -r|--resource) OCF_RESOURCE_INSTANCE=$2; shift; shift;; - --version) crm_attribute --version; exit 0;; - --help) - echo "crm_master - A convenience wrapper for crm_attribute"; - echo ""; - echo "Set, update or delete a resource's promotion score"; - echo ""; - echo "This program should normally only be invoked from inside an OCF resource agent" - echo ""; - echo "Usage: crm_master command [options]"; - echo "Options:" - echo " --help This text" - echo " --version Version information" - echo " -V, --verbose Increase debug output" - echo " -q, --quiet Print only the value on stdout" - echo "" - echo "Commands:" - echo " -G, --query Query the current value of the attribute/option" - echo " -v, --update=value Update the value of the attribute/option" - echo " -D, --delete Delete the attribute/option" - echo "" - echo "Additional Options:" - echo " -N, --node=value Set an attribute for the named node (instead of the current one)." - echo " -l, --lifetime=value Until when should the setting take affect." - echo " Valid values: reboot, forever" - echo " -i, --id=value (Advanced) The ID used to identify the attribute" - exit 0;; - --) shift ; break ;; - *) echo "Unknown option: $1. See --help for details." exit 1;; + --help) + echo "$HELP_TEXT" + exit 0 + ;; + --version) + crm_attribute --version + exit 0 + ;; + --) + shift + break + ;; + *) + exit_usage "unknown option '$1'" + ;; esac done if [ -z "$OCF_RESOURCE_INSTANCE" ]; then - echo "This program should normally only be invoked from inside an OCF resource agent" - echo "To set the promotion/master score from the command line, please specify a resource ID with -r" - exit 1 + echo "This program should normally only be invoked from inside an OCF resource agent." + echo "To set a promotion score from the command line, please specify resource with -r." + exit 1 fi crm_attribute -N $target -n master-$OCF_RESOURCE_INSTANCE $options
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor