From 68ec40bdd706d7a5c9190a552791bc86a30b128b Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Tue, 16 Jul 2019 17:19:09 -0500
Subject: [PATCH 5/6] Low: extra: use ":=" where appropriate in agent code

... instead of "=" when assigning default values (i.e., use the default when
variable is set to empty, as well as when it is unset).
---
 extra/resources/ClusterMon.in  |  4 ++--
 extra/resources/Dummy          | 10 +++++-----
 extra/resources/HealthCPU      |  6 +++---
 extra/resources/HealthIOWait   |  6 +++---
 extra/resources/HealthSMART.in |  6 +++---
 extra/resources/Stateful       | 12 ++++++------
 extra/resources/SysInfo.in     |  4 ++--
 extra/resources/SystemHealth   |  6 +++---
 extra/resources/attribute      |  4 ++--
 extra/resources/controld       | 12 ++++++------
 extra/resources/ifspeed.in     | 14 +++++++-------
 extra/resources/o2cb.in        |  4 ++--
 extra/resources/ping           |  4 ++--
 extra/resources/pingd          |  4 ++--
 extra/resources/remote         |  4 ++--
 15 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/extra/resources/ClusterMon.in b/extra/resources/ClusterMon.in
index c533d2356..cc687acd8 100755
--- a/extra/resources/ClusterMon.in
+++ b/extra/resources/ClusterMon.in
@@ -23,9 +23,9 @@
 
 #######################################################################
 # Initialization:
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
diff --git a/extra/resources/Dummy b/extra/resources/Dummy
index 33d892b61..be93c92ea 100755
--- a/extra/resources/Dummy
+++ b/extra/resources/Dummy
@@ -17,9 +17,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
@@ -232,9 +232,9 @@ dummy_validate() {
     return $OCF_SUCCESS
 }
 
-: ${OCF_RESKEY_fake=dummy}
-: ${OCF_RESKEY_op_sleep=0}
-: ${OCF_RESKEY_CRM_meta_interval=0}
+: ${OCF_RESKEY_fake:=dummy}
+: ${OCF_RESKEY_op_sleep:=0}
+: ${OCF_RESKEY_CRM_meta_interval:=0}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 if [ -z "$OCF_RESKEY_state" ]; then
diff --git a/extra/resources/HealthCPU b/extra/resources/HealthCPU
index 1f5cdcb21..053ade05f 100755
--- a/extra/resources/HealthCPU
+++ b/extra/resources/HealthCPU
@@ -23,9 +23,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
@@ -155,7 +155,7 @@ dummy_validate() {
     return $OCF_SUCCESS
 }
 
-: ${OCF_RESKEY_CRM_meta_interval=0}
+: ${OCF_RESKEY_CRM_meta_interval:=0}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 if [ "x$OCF_RESKEY_state" = "x" ]; then
diff --git a/extra/resources/HealthIOWait b/extra/resources/HealthIOWait
index a6c132c8f..8d21bbb45 100755
--- a/extra/resources/HealthIOWait
+++ b/extra/resources/HealthIOWait
@@ -16,9 +16,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
@@ -135,7 +135,7 @@ agent_validate() {
     return $OCF_SUCCESS
 }
 
-: ${OCF_RESKEY_CRM_meta_interval=0}
+: ${OCF_RESKEY_CRM_meta_interval:=0}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 if [ "x$OCF_RESKEY_state" = "x" ]; then
diff --git a/extra/resources/HealthSMART.in b/extra/resources/HealthSMART.in
index 983d799c9..5f0815dd3 100755
--- a/extra/resources/HealthSMART.in
+++ b/extra/resources/HealthSMART.in
@@ -19,9 +19,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 #
 SMARTCTL=/usr/sbin/smartctl
 ATTRDUP=/usr/sbin/attrd_updater
@@ -279,7 +279,7 @@ HealthSMART_validate() {
     return $OCF_SUCCESS
 }
 
-: ${OCF_RESKEY_CRM_meta_interval=0}
+: ${OCF_RESKEY_CRM_meta_interval:=0}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
 
 if [ "x$OCF_RESKEY_state" = "x" ]; then
diff --git a/extra/resources/Stateful b/extra/resources/Stateful
index 35d84aa8d..e65c96c1b 100755
--- a/extra/resources/Stateful
+++ b/extra/resources/Stateful
@@ -17,9 +17,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 CRM_MASTER="${HA_SBIN_DIR}/crm_master -l reboot"
 
 #######################################################################
@@ -202,11 +202,11 @@ stateful_validate() {
     exit $OCF_SUCCESS
 }
 
-: ${slave_score=5}
-: ${master_score=10}
+: ${slave_score:=5}
+: ${master_score:=10}
 
-: ${OCF_RESKEY_CRM_meta_interval=0}
-: ${OCF_RESKEY_notify_delay=0}
+: ${OCF_RESKEY_CRM_meta_interval:=0}
+: ${OCF_RESKEY_notify_delay:=0}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 if [ "x$OCF_RESKEY_state" = "x" ]; then
diff --git a/extra/resources/SysInfo.in b/extra/resources/SysInfo.in
index 8de271462..022ebd0d9 100755
--- a/extra/resources/SysInfo.in
+++ b/extra/resources/SysInfo.in
@@ -17,9 +17,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
diff --git a/extra/resources/SystemHealth b/extra/resources/SystemHealth
index e23ad4ec4..c76c5f330 100755
--- a/extra/resources/SystemHealth
+++ b/extra/resources/SystemHealth
@@ -13,9 +13,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
@@ -199,7 +199,7 @@ SystemHealth_validate() {
     return $OCF_SUCCESS
 }
 
-: ${OCF_RESKEY_program=/usr/sbin/notifyServicelogEvent}
+: ${OCF_RESKEY_program:=/usr/sbin/notifyServicelogEvent}
 
 case $__OCF_ACTION in
 meta-data)      meta_data
diff --git a/extra/resources/attribute b/extra/resources/attribute
index 626607f6f..fc814b75a 100755
--- a/extra/resources/attribute
+++ b/extra/resources/attribute
@@ -15,9 +15,9 @@ USAGE="Usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-d
 Expects to have a fully populated OCF RA-compliant environment set."
 
 # Load OCF helper functions
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 # Ensure certain variables are set and not empty
 : ${HA_VARRUN:="/var/run"}
diff --git a/extra/resources/controld b/extra/resources/controld
index 4dd27d42c..ca9a0f6a4 100755
--- a/extra/resources/controld
+++ b/extra/resources/controld
@@ -16,9 +16,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
@@ -249,21 +249,21 @@ controld_validate() {
     return $OCF_SUCCESS
 }
 
-: ${OCF_RESKEY_sctp=false}
+: ${OCF_RESKEY_sctp:=false}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
 
 case "$OCF_RESOURCE_INSTANCE" in
     *[gG][fF][sS]*)
         : ${OCF_RESKEY_args=-g 0}
-        : ${OCF_RESKEY_daemon=gfs_controld}
+        : ${OCF_RESKEY_daemon:=gfs_controld}
         ;;
     *[dD][lL][mM]*)
         : ${OCF_RESKEY_args=-s 0}
-        : ${OCF_RESKEY_daemon=dlm_controld}
+        : ${OCF_RESKEY_daemon:=dlm_controld}
         ;;
     *)
         : ${OCF_RESKEY_args=-s 0}
-        : ${OCF_RESKEY_daemon=dlm_controld}
+        : ${OCF_RESKEY_daemon:=dlm_controld}
 esac
 
 case $__OCF_ACTION in
diff --git a/extra/resources/ifspeed.in b/extra/resources/ifspeed.in
index d423442b1..63a1291cd 100755
--- a/extra/resources/ifspeed.in
+++ b/extra/resources/ifspeed.in
@@ -33,15 +33,15 @@
 #
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 
 # If these aren't available, we can still show help,
 # which is all that is needed to build the man pages.
 [ -r "${OCF_FUNCTIONS}" ] && . "${OCF_FUNCTIONS}"
 [ -r "${OCF_FUNCTIONS_DIR}/findif.sh" ] && . "${OCF_FUNCTIONS_DIR}/findif.sh"
-: ${OCF_SUCCESS=0}
+: ${OCF_SUCCESS:=0}
 
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 FINDIF=findif
 
@@ -51,10 +51,10 @@ OCF_RESKEY_bridge_ports_default="detect"
 OCF_RESKEY_weight_base_default=1000
 OCF_RESKEY_dampen_default=5
 
-: ${OCF_RESKEY_name=${OCF_RESKEY_name_default}}
-: ${OCF_RESKEY_bridge_ports=${OCF_RESKEY_bridge_ports_default}}
-: ${OCF_RESKEY_weight_base=${OCF_RESKEY_weight_base_default}}
-: ${OCF_RESKEY_dampen=${OCF_RESKEY_dampen_default}}
+: ${OCF_RESKEY_name:=${OCF_RESKEY_name_default}}
+: ${OCF_RESKEY_bridge_ports:=${OCF_RESKEY_bridge_ports_default}}
+: ${OCF_RESKEY_weight_base:=${OCF_RESKEY_weight_base_default}}
+: ${OCF_RESKEY_dampen:=${OCF_RESKEY_dampen_default}}
 
 meta_data() {
         cat <<END
diff --git a/extra/resources/o2cb.in b/extra/resources/o2cb.in
index a3cf9760b..1cc7fb3bb 100755
--- a/extra/resources/o2cb.in
+++ b/extra/resources/o2cb.in
@@ -13,9 +13,9 @@
 
 #######################################################################
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 : ${OCF_RESKEY_stack:="pcmk"}
 : ${OCF_RESKEY_sysfs:="/sys/fs"}
diff --git a/extra/resources/ping b/extra/resources/ping
index ce46d3fe2..6d64d4db3 100755
--- a/extra/resources/ping
+++ b/extra/resources/ping
@@ -13,9 +13,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
diff --git a/extra/resources/pingd b/extra/resources/pingd
index f84a77273..cec8ccfa8 100755
--- a/extra/resources/pingd
+++ b/extra/resources/pingd
@@ -17,9 +17,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 : ${OCF_RESKEY_name:="pingd"}
 : ${OCF_RESKEY_interval:="1"}
diff --git a/extra/resources/remote b/extra/resources/remote
index 6da7a36f3..0a2d09e15 100755
--- a/extra/resources/remote
+++ b/extra/resources/remote
@@ -19,9 +19,9 @@
 #######################################################################
 # Initialization:
 
-: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
+: ${OCF_FUNCTIONS:=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
 . ${OCF_FUNCTIONS}
-: ${__OCF_ACTION=$1}
+: ${__OCF_ACTION:=$1}
 
 #######################################################################
 
-- 
2.26.2

