File bsc#1175557-0003-Refactor-extra-remove-trailing-whitespace-from-agent.patch of Package pacemaker.19271

From ef4e4917761c84731ebba652304fc05b797f7a26 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Wed, 17 Jul 2019 15:19:15 -0500
Subject: [PATCH 3/6] Refactor: extra: remove trailing whitespace from agent
 code

---
 extra/resources/ClusterMon.in  |  1 -
 extra/resources/Dummy          |  8 ++++----
 extra/resources/HealthCPU      | 12 ++++++------
 extra/resources/HealthSMART.in | 10 +++++-----
 extra/resources/Stateful       |  8 ++++----
 extra/resources/SysInfo.in     | 12 ++++++------
 extra/resources/SystemHealth   |  2 +-
 extra/resources/controld       |  8 ++++----
 extra/resources/ifspeed.in     | 22 +++++++++++-----------
 extra/resources/o2cb.in        |  8 ++++----
 extra/resources/ping           | 28 ++++++++++++++--------------
 extra/resources/pingd          |  2 +-
 12 files changed, 60 insertions(+), 61 deletions(-)

diff --git a/extra/resources/ClusterMon.in b/extra/resources/ClusterMon.in
index b381c83b6..ed8bc7673 100755
--- a/extra/resources/ClusterMon.in
+++ b/extra/resources/ClusterMon.in
@@ -218,7 +218,6 @@ ClusterMon_validate() {
         *) ocf_log warn "You should have htmlfile($OCF_RESKEY_htmlfile) of absolute path!" ;;
     esac
 
-     
     echo "Validate OK"
     return $OCF_SUCCESS
 }
diff --git a/extra/resources/Dummy b/extra/resources/Dummy
index 950b631e0..643d1afa6 100755
--- a/extra/resources/Dummy
+++ b/extra/resources/Dummy
@@ -31,7 +31,7 @@ meta_data() {
 <version>1.0</version>
 
 <longdesc lang="en">
-This is a Dummy Resource Agent. It does absolutely nothing except 
+This is a Dummy Resource Agent. It does absolutely nothing except
 keep track of whether its running or not.
 Its purpose in life is for testing and to serve as a template for RA writers.
 
@@ -187,7 +187,7 @@ dummy_monitor() {
         sleep ${OCF_RESKEY_op_sleep}
         rm "${VERIFY_SERIALIZED_FILE}"
     fi
-    
+
     if [ -f "${OCF_RESKEY_state}" ]; then
         # Multiple monitor levels are defined to support various tests
         case "$OCF_CHECK_LEVEL" in
@@ -220,8 +220,8 @@ dummy_monitor() {
 }
 
 dummy_validate() {
-    
-    # Is the state directory writable? 
+
+    # Is the state directory writable?
     state_dir=`dirname "$OCF_RESKEY_state"`
     touch "$state_dir/$$"
     if [ $? -ne 0 ]; then
diff --git a/extra/resources/HealthCPU b/extra/resources/HealthCPU
index 379b9e81e..767b15451 100755
--- a/extra/resources/HealthCPU
+++ b/extra/resources/HealthCPU
@@ -111,7 +111,7 @@ dummy_monitor() {
     # Monitor _MUST!_ differentiate correctly between running
     # (SUCCESS), failed (ERROR) or _cleanly_ stopped (NOT RUNNING).
     # That is THREE states, not just yes/no.
-        
+
     if [ -f ${OCF_RESKEY_state} ]; then
 
         IDLE=`top -b -n2 | grep Cpu | tail -1 | awk -F",|.[0-9][ %]id" '{ print $4 }'`
@@ -132,7 +132,7 @@ dummy_monitor() {
             # echo "System state green."
             attrd_updater -n "#health-cpu" -U "green" -d "30s"
         fi
-        
+
         return $OCF_SUCCESS
     fi
 
@@ -143,8 +143,8 @@ dummy_monitor() {
 }
 
 dummy_validate() {
-    
-    # Is the state directory writable? 
+
+    # Is the state directory writable?
     state_dir=`dirname "$OCF_RESKEY_state"`
     touch "$state_dir/$$"
     if [ $? != 0 ]; then
@@ -161,10 +161,10 @@ dummy_validate() {
 if [ "x$OCF_RESKEY_state" = "x" ]; then
     if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
         state="${HA_VARRUN%%/}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
-        
+
         # Strip off the trailing clone marker
         OCF_RESKEY_state=`echo $state | sed s/:[0-9][0-9]*\.state/.state/`
-    else 
+    else
         OCF_RESKEY_state="${HA_VARRUN%%/}/Dummy-${OCF_RESOURCE_INSTANCE}.state"
     fi
 fi
diff --git a/extra/resources/HealthSMART.in b/extra/resources/HealthSMART.in
index f4aad16b4..419b0658e 100755
--- a/extra/resources/HealthSMART.in
+++ b/extra/resources/HealthSMART.in
@@ -107,7 +107,7 @@ END
 #######################################################################
 
 check_temperature() {
-    
+
     if [ $1 -lt ${lower_red_limit} ] ; then
         ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C"
         $ATTRDUP -n "#health-smart" -U "red" -d "5s"
@@ -119,13 +119,13 @@ check_temperature() {
         $ATTRDUP -n "#health-smart" -U "red" -d "5s"
         return 1
     fi
-    
+
     if [ $1 -lt ${lower_yellow_limit} ] ; then
         ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C"
         $ATTRDUP -n "#health-smart" -U "yellow" -d "5s"
         return 1
     fi
-    
+
     if [ $1 -gt ${upper_yellow_limit} ] ; then
         ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C"
         $ATTRDUP -n "#health-smart" -U "yellow" -d "5s"
@@ -239,7 +239,7 @@ HealthSMART_monitor() {
                     return $OCF_SUCCESS
                 fi
             fi
-            
+
             # Check drive temperature(s)
             if [ "${OCF_RESKEY_devices}" ]; then
                 for DEVICE in ${OCF_RESKEY_devices}; do
@@ -298,7 +298,7 @@ case $__OCF_ACTION in
     stop)         HealthSMART_stop;;
     monitor)      HealthSMART_monitor;;
     validate-all) HealthSMART_validate;;
-    meta-data) 
+    meta-data)
         meta_data
         exit $OCF_SUCCESS
         ;;
diff --git a/extra/resources/Stateful b/extra/resources/Stateful
index da776ebe4..9d746a414 100755
--- a/extra/resources/Stateful
+++ b/extra/resources/Stateful
@@ -131,7 +131,7 @@ stateful_start() {
 }
 
 stateful_demote() {
-    stateful_check_state 
+    stateful_check_state
     if [ $? = 0 ]; then
         # CRM Error - Should never happen
         return $OCF_NOT_RUNNING
@@ -142,7 +142,7 @@ stateful_demote() {
 }
 
 stateful_promote() {
-    stateful_check_state 
+    stateful_check_state
     if [ $? = 0 ]; then
         return $OCF_NOT_RUNNING
     fi
@@ -212,10 +212,10 @@ stateful_validate() {
 if [ "x$OCF_RESKEY_state" = "x" ]; then
     if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
         state="${HA_VARRUN%%/}/Stateful-${OCF_RESOURCE_INSTANCE}.state"
-        
+
         # Strip off the trailing clone marker
         OCF_RESKEY_state=`echo $state | sed s/:[0-9][0-9]*\.state/.state/`
-    else 
+    else
         OCF_RESKEY_state="${HA_VARRUN%%/}/Stateful-${OCF_RESOURCE_INSTANCE}.state"
     fi
 fi
diff --git a/extra/resources/SysInfo.in b/extra/resources/SysInfo.in
index bd6ce48e2..77888048f 100755
--- a/extra/resources/SysInfo.in
+++ b/extra/resources/SysInfo.in
@@ -139,7 +139,7 @@ UpdateStat() {
     printf "%s:\t%s\n" "$name" "$value"
     if [ "$__OCF_ACTION" = "start" ] ; then
         ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -S status -n $name -B "$value"
-    else 
+    else
         ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -S status -n $name -v "$value"
     fi
 }
@@ -254,7 +254,7 @@ SysInfo_megabytes() {
 SysInfo_mem_units() {
     mem=$1
 
-    if [ -z $1 ]; then 
+    if [ -z $1 ]; then
         return
     fi
 
@@ -265,20 +265,20 @@ SysInfo_mem_units() {
         mem=$(($mem + 50 - $r))
     fi
 
-    echo $mem    
+    echo $mem
 }
 
 SysInfo_hdd_units() {
     # Defauts to size in gigabytes
 
-    case $OCF_RESKEY_disk_unit in 
+    case $OCF_RESKEY_disk_unit in
         [Pp]) echo $(($(SysInfo_megabytes "$1") / 1024 / 1024 / 1024));;
         [Tt]) echo $(($(SysInfo_megabytes "$1") / 1024 / 1024));;
         [Gg]) echo $(($(SysInfo_megabytes "$1") / 1024));;
         [Mm]) echo "$(SysInfo_megabytes "$1")" ;;
         [Kk]) echo $(($(SysInfo_megabytes "$1") * 1024));;
         [Bb]) echo $(($(SysInfo_megabytes "$1") * 1024 * 1024));;
-        *) 
+        *)
             ocf_log err "Invalid value for disk_unit: $OCF_RESKEY_disk_unit"
             echo $(($(SysInfo_megabytes "$1") / 1024));;
     esac
@@ -337,7 +337,7 @@ fi
 : ${OCF_RESKEY_clone:="0"}
 if [ x != x${OCF_RESKEY_delay} ]; then
     OCF_RESKEY_delay="-d ${OCF_RESKEY_delay}"
-else 
+else
     OCF_RESKEY_delay="-d 0"
 fi
 MIN_FREE=""
diff --git a/extra/resources/SystemHealth b/extra/resources/SystemHealth
index ef05e2d11..de4b056ff 100755
--- a/extra/resources/SystemHealth
+++ b/extra/resources/SystemHealth
@@ -188,7 +188,7 @@ SystemHealth_monitor() {
 }
 
 SystemHealth_validate() {
-    
+
     SystemHealth_check_tools
     RC=$?
 
diff --git a/extra/resources/controld b/extra/resources/controld
index 977d2664f..0936a2493 100755
--- a/extra/resources/controld
+++ b/extra/resources/controld
@@ -166,10 +166,10 @@ controld_start() {
                 return $OCF_SUCCESS
             fi
             ;;
-          $OCF_NOT_RUNNING) 
+          $OCF_NOT_RUNNING)
             return $OCF_NOT_RUNNING
             ;;
-          *) 
+          *)
             return $OCF_ERR_GENERIC
             ;;
         esac
@@ -238,7 +238,7 @@ controld_validate() {
     check_binary ${OCF_RESKEY_daemon}
 
     case ${OCF_RESKEY_CRM_meta_globally_unique} in
-        yes|Yes|true|True|1) 
+        yes|Yes|true|True|1)
             ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the globally_unique=false meta attribute"
             exit $OCF_ERR_CONFIGURED
             ;;
@@ -253,7 +253,7 @@ controld_validate() {
 : ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 case "$OCF_RESOURCE_INSTANCE" in
-    *[gG][fF][sS]*) 
+    *[gG][fF][sS]*)
         : ${OCF_RESKEY_args=-g 0}
         : ${OCF_RESKEY_daemon=gfs_controld}
         ;;
diff --git a/extra/resources/ifspeed.in b/extra/resources/ifspeed.in
index 860d9d298..49d4c1c3d 100755
--- a/extra/resources/ifspeed.in
+++ b/extra/resources/ifspeed.in
@@ -27,7 +27,7 @@
 #    OCF_RESKEY_iface:        network interface to monitor
 #    OCF_RESKEY_bridge_ports: if not null and OCF_RESKEY_iface is a bridge, list of
 #                             bridge ports to consider.
-#                             Default is all ports which have designated_bridge=root_id 
+#                             Default is all ports which have designated_bridge=root_id
 #    OCF_RESKEY_weight_base:  Relative weight of 1Gbps. This can be used to tune
 #                             value of resulting CIB attribute.
 #
@@ -85,7 +85,7 @@ For balancing bonds this RA summs speeds of underlying "up" slave interfaces
 (and applies coefficient 0.8 to result).
 
 For non-balancing bonds ('active-backup' and probably 'broadcast'), only the
-speed of the currently active slave is used. 
+speed of the currently active slave is used.
 </longdesc>
 <shortdesc lang="en">Network interface speed monitor</shortdesc>
 
@@ -319,7 +319,7 @@ bridge_get_root_ports() {
 
     root_ports=${root_ports# }
 
-    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell. 
+    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell.
         eval "$2=\${root_ports}"
     else # Expect sub-shell
         echo ${root_ports}
@@ -363,7 +363,7 @@ bridge_get_active_ports() {
         fi
     done
     if [ ${warn} -eq 1 ] ; then
-        ocf_log warning "More then one upstream port in bridge '${bridge}' is in forwarding state while STP is enabled: ${active_ports}" 
+        ocf_log warning "More then one upstream port in bridge '${bridge}' is in forwarding state while STP is enabled: ${active_ports}"
     fi
     echo "${active_ports# }"
 }
@@ -381,7 +381,7 @@ bridge_get_speed() {
     for port in ${BGS_PORTS} ; do
         : $(( aggregate_speed += $( iface_get_speed ${port} ) ))
     done
-    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell. 
+    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell.
         eval "$2=\${aggregate_speed}"
     else # Expect sub-shell
         echo ${aggregate_speed}
@@ -400,8 +400,8 @@ hfi1_get_speed() {
     # [root@es-host0 ~]# cat /sys/class/net/ib0/device/infiniband/*/ports/*/rate
     # 100 Gb/sec (4X EDR)
     read hfi1_speed hfi1_value hfi1_desc < /sys/class/net/${iface}/device/infiniband/*/ports/*/rate
-    ocf_is_true ${OCF_RESKEY_debug} && ocf_log debug "Detected speed $hfi1_speed $hfi1_value $hfi1_desc" 
-    
+    ocf_is_true ${OCF_RESKEY_debug} && ocf_log debug "Detected speed $hfi1_speed $hfi1_value $hfi1_desc"
+
     # hfi1_value always in Gb/sec, so we need to convert hfi1_speed in Mb/sec
     echo $(( hfi1_speed * 1000 ))
 }
@@ -410,7 +410,7 @@ bond_get_slaves() {
     local iface=$1
     local slaves
     read slaves < "/sys/class/net/${iface}/bonding/slaves"
-    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell. 
+    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell.
         eval "$2=\${slaves}"
     else # Expect sub-shell
         echo ${slaves}
@@ -421,7 +421,7 @@ bond_get_active_iface() {
     local iface=$1
     local active
     read active < "/sys/class/net/${iface}/bonding/active_slave"
-    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell. 
+    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell.
         eval "$2=\${active}"
     else # Expect sub-shell
         echo ${active}
@@ -465,7 +465,7 @@ bond_get_speed() {
         bond_get_active_iface ${iface} active_iface
         aggregate_speed=$( iface_get_speed $active_iface )
     fi
-    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell. 
+    if [ -n "$2" ] ; then # Record value in specified var. This expects we were called not in a sub-shell.
         eval "$2=\${aggregate_speed}"
     else # Expect sub-shell
         echo ${aggregate_speed}
@@ -487,7 +487,7 @@ update() {
     : $(( score = speed * ${OCF_RESKEY_weight_base} / 1000 ))
     if [ "$__OCF_ACTION" = "start" ] ; then
         attrd_updater -n ${OCF_RESKEY_name} -B ${score} -d ${OCF_RESKEY_dampen} ${attrd_options}
-    else 
+    else
         attrd_updater -n ${OCF_RESKEY_name} -v ${score} -d ${OCF_RESKEY_dampen} ${attrd_options}
     fi
     rc=$?
diff --git a/extra/resources/o2cb.in b/extra/resources/o2cb.in
index db3ad1bae..5b6ad7ae6 100755
--- a/extra/resources/o2cb.in
+++ b/extra/resources/o2cb.in
@@ -69,7 +69,7 @@ check_filesystem()
 }
 
 #
-# Unload a filesystem driver.  
+# Unload a filesystem driver.
 # Be careful to notice if the driver is built-in and do nothing.
 #
 # 0 is success, 1 is error, 2 is already unloaded.
@@ -214,7 +214,7 @@ unload_module()
 o2cb_start() {
 
     o2cb_monitor; rc=$?
-    if [ $rc != $OCF_NOT_RUNNING ]; then 
+    if [ $rc != $OCF_NOT_RUNNING ]; then
         return $rc
     fi
 
@@ -277,7 +277,7 @@ o2cb_stop() {
     ocf_log info "Stopping $OCF_RESOURCE_INSTANCE"
 
     kill_daemon
-    if [ $? != 0 ]; then 
+    if [ $? != 0 ]; then
         ocf_log err "Unable to unload modules: the cluster is still online"
         return $OCF_ERR_GENERIC
     fi
@@ -357,7 +357,7 @@ o2cb_validate() {
     check_binary ${DAEMON}
 
     case ${OCF_RESKEY_CRM_meta_globally_unique} in
-        yes|Yes|true|True|1) 
+        yes|Yes|true|True|1)
             ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the globally_unique=false meta attribute"
             exit $OCF_ERR_CONFIGURED
             ;;
diff --git a/extra/resources/ping b/extra/resources/ping
index 19d383915..10c272b7b 100755
--- a/extra/resources/ping
+++ b/extra/resources/ping
@@ -137,7 +137,7 @@ END
 #######################################################################
 
 ping_conditional_log() {
-    level=$1; shift 
+    level=$1; shift
     if [ ${OCF_RESKEY_debug} = "true" ]; then
         ocf_log $level "$*"
     fi
@@ -163,9 +163,9 @@ ping_start() {
 ping_stop() {
 
     rm -f ${OCF_RESKEY_pidfile}
-    
+
     attrd_updater -D -n $OCF_RESKEY_name -d $OCF_RESKEY_dampen $attrd_options
-    
+
     return $OCF_SUCCESS
 }
 
@@ -181,7 +181,7 @@ ping_monitor() {
 }
 
 ping_validate() {
-    # Is the state directory writable? 
+    # Is the state directory writable?
     state_dir=`dirname "$OCF_RESKEY_pidfile"`
     touch "$state_dir/$$"
     if [ $? != 0 ]; then
@@ -195,9 +195,9 @@ ping_validate() {
         /*) ;;
         *) ocf_log warn "You should use an absolute path for pidfile not: $OCF_RESKEY_pidfile" ;;
     esac
-    
+
 # Check the host list
-    if [ "x" = "x$OCF_RESKEY_host_list" ]; then 
+    if [ "x" = "x$OCF_RESKEY_host_list" ]; then
         ocf_log err "Empty host_list.  Please specify some nodes to ping"
         exit $OCF_ERR_CONFIGURED
     fi
@@ -234,14 +234,14 @@ fping_check() {
     active=`echo "$output" | grep "is alive" | wc -l`
 
     case $rc in
-        0) 
+        0)
             ;;
-        1) 
+        1)
             for h in `echo "$output" | grep "is unreachable" | awk '{print $1}'`; do
                 ping_conditional_log warn "$h is inactive"
             done
             ;;
-        *) 
+        *)
             ocf_log err "Unexpected result for '$cmd' $rc: `echo "$output" | tr '\n' ';'`"
             ;;
     esac
@@ -264,7 +264,7 @@ ping_check() {
         case $host in
             *:*) p_exe=ping6
         esac
-        
+
         p_out=`$p_exe $p_args $OCF_RESKEY_options $host 2>&1`; rc=$?
 
         case $rc in
@@ -277,7 +277,7 @@ ping_check() {
 }
 
 ping_update() {
-    
+
     if use_fping; then
         fping_check
         active=$?
@@ -293,7 +293,7 @@ ping_update() {
         attrd_updater -n $OCF_RESKEY_name -v $score -d $OCF_RESKEY_dampen $attrd_options
     fi
     rc=$?
-    case $rc in 
+    case $rc in
         0) ping_conditional_log debug "Updated $OCF_RESKEY_name = $score" ;;
         *) ocf_log warn "Could not update $OCF_RESKEY_name = $score: rc=$rc";;
     esac
@@ -331,7 +331,7 @@ hosts_family() {
     family=0
     for host in $OCF_RESKEY_host_list; do
         host_family $host
-        f=$?        
+        f=$?
         if [ $family -ne 0 ] && [ $f -ne 0 ] && [ $f -ne $family ] ; then
             family=99
             break
@@ -379,7 +379,7 @@ fi
 
 if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
     : ${OCF_RESKEY_pidfile:="${HA_VARRUN%%/}/ping-${OCF_RESKEY_name}"}
-else 
+else
     : ${OCF_RESKEY_pidfile:="${HA_VARRUN%%/}/ping-${OCF_RESOURCE_INSTANCE}"}
 fi
 
diff --git a/extra/resources/pingd b/extra/resources/pingd
index 468429768..2723ad03c 100755
--- a/extra/resources/pingd
+++ b/extra/resources/pingd
@@ -49,7 +49,7 @@ case $__OCF_ACTION in
             ocf_log err "Preventing startup to ensure the issue is addressed before it matters"
             exit $OCF_ERR_ARGS
         fi
-        
+
         if [ $OCF_RESKEY_CRM_meta_interval = 0 ]; then
             ocf_log warn "$upgrade1"
             ocf_log warn "$upgrade2"
-- 
2.26.2

openSUSE Build Service is sponsored by