|
|
b8c11e |
From 6eb95429bb92cab5616feaef0111733f79164811 Mon Sep 17 00:00:00 2001
|
|
|
b8c11e |
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
|
|
b8c11e |
Date: Thu, 19 Jul 2018 19:11:36 +0200
|
|
|
b8c11e |
Subject: [PATCH 3/3] maint: ocf + script: eliminate some false positives with
|
|
|
b8c11e |
ShellCheck
|
|
|
b8c11e |
MIME-Version: 1.0
|
|
|
b8c11e |
Content-Type: text/plain; charset=UTF-8
|
|
|
b8c11e |
Content-Transfer-Encoding: 8bit
|
|
|
b8c11e |
|
|
|
b8c11e |
In particular, prevent sed's character classes to be confused with
|
|
|
b8c11e |
array-like variable access through specified index, which demonstrates
|
|
|
b8c11e |
why it's better to have the ${variable} "enbraced".
|
|
|
b8c11e |
|
|
|
b8c11e |
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
|
|
|
b8c11e |
---
|
|
|
b8c11e |
script/ocf/booth-site | 7 +++++++
|
|
|
b8c11e |
script/ocf/geostore | 2 ++
|
|
|
b8c11e |
script/ocf/sharedrsc | 5 +++++
|
|
|
b8c11e |
script/service-runnable.in | 2 +-
|
|
|
b8c11e |
4 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
b8c11e |
|
|
|
b8c11e |
diff --git a/script/ocf/booth-site b/script/ocf/booth-site
|
|
|
b8c11e |
index 809928c..8178e35 100755
|
|
|
b8c11e |
--- a/script/ocf/booth-site
|
|
|
b8c11e |
+++ b/script/ocf/booth-site
|
|
|
b8c11e |
@@ -30,6 +30,7 @@ DEFAULT_BIN="boothd"
|
|
|
b8c11e |
DEFAULT_CONF="/etc/booth/booth.conf"
|
|
|
b8c11e |
|
|
|
b8c11e |
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
|
|
b8c11e |
+# shellcheck source=/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
|
|
|
b8c11e |
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
|
|
b8c11e |
|
|
|
b8c11e |
#######################################################################
|
|
|
b8c11e |
@@ -140,6 +141,8 @@ booth_site_start() {
|
|
|
b8c11e |
$OCF_NOT_RUNNING) ;;
|
|
|
b8c11e |
esac
|
|
|
b8c11e |
|
|
|
b8c11e |
+ # shellcheck disable=SC2154
|
|
|
b8c11e |
+ # (OCF_RESKEY_args: injected by CRM)
|
|
|
b8c11e |
$OCF_RESKEY_daemon daemon -c $OCF_RESKEY_config $OCF_RESKEY_args ||
|
|
|
b8c11e |
return $OCF_ERR_GENERIC
|
|
|
b8c11e |
sleep 1
|
|
|
b8c11e |
@@ -188,6 +191,8 @@ booth_site_validate_all() {
|
|
|
b8c11e |
return $OCF_ERR_INSTALLED
|
|
|
b8c11e |
fi
|
|
|
b8c11e |
|
|
|
b8c11e |
+ # shellcheck disable=SC2154
|
|
|
b8c11e |
+ # (OCF_RESKEY_CRM_meta_globally_unique: injected by CRM)
|
|
|
b8c11e |
if ocf_is_true $OCF_RESKEY_CRM_meta_globally_unique; then
|
|
|
b8c11e |
ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the globally_unique=false meta attribute"
|
|
|
b8c11e |
return $OCF_ERR_CONFIGURED
|
|
|
b8c11e |
@@ -198,6 +203,8 @@ booth_site_validate_all() {
|
|
|
b8c11e |
|
|
|
b8c11e |
: ${OCF_RESKEY_daemon:=$DEFAULT_BIN}
|
|
|
b8c11e |
: ${OCF_RESKEY_config:=$DEFAULT_CONF}
|
|
|
b8c11e |
+# shellcheck disable=SC2034
|
|
|
b8c11e |
+# (OCF_REQUIRED_BINARIES consumed by ocf_rarun)
|
|
|
b8c11e |
OCF_REQUIRED_BINARIES=${OCF_RESKEY_daemon}
|
|
|
b8c11e |
|
|
|
b8c11e |
ocf_rarun $*
|
|
|
b8c11e |
diff --git a/script/ocf/geostore b/script/ocf/geostore
|
|
|
b8c11e |
index 85842a8..c180418 100755
|
|
|
b8c11e |
--- a/script/ocf/geostore
|
|
|
b8c11e |
+++ b/script/ocf/geostore
|
|
|
b8c11e |
@@ -31,7 +31,9 @@
|
|
|
b8c11e |
# Initialization:
|
|
|
b8c11e |
|
|
|
b8c11e |
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
|
|
b8c11e |
+# shellcheck source=/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
|
|
|
b8c11e |
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
|
|
b8c11e |
+# shellcheck source=script/ocf/geo_attr.sh
|
|
|
b8c11e |
. ${OCF_ROOT}/lib/booth/geo_attr.sh
|
|
|
b8c11e |
|
|
|
b8c11e |
#######################################################################
|
|
|
b8c11e |
diff --git a/script/ocf/sharedrsc b/script/ocf/sharedrsc
|
|
|
b8c11e |
index 384cfd2..c2ed8ff 100755
|
|
|
b8c11e |
--- a/script/ocf/sharedrsc
|
|
|
b8c11e |
+++ b/script/ocf/sharedrsc
|
|
|
b8c11e |
@@ -36,6 +36,7 @@
|
|
|
b8c11e |
# Initialization:
|
|
|
b8c11e |
|
|
|
b8c11e |
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
|
|
b8c11e |
+# shellcheck source=/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
|
|
|
b8c11e |
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
|
|
b8c11e |
|
|
|
b8c11e |
#######################################################################
|
|
|
b8c11e |
@@ -148,6 +149,8 @@ sharedrsc_start() {
|
|
|
b8c11e |
if ! owner=`runcmd getowner $DIR`; then
|
|
|
b8c11e |
owner="... nobody, it's only half-claimed"
|
|
|
b8c11e |
fi
|
|
|
b8c11e |
+ # shellcheck disable=SC2154
|
|
|
b8c11e |
+ # (OCF_RESKEY_dir: injected by CRM)
|
|
|
b8c11e |
ocf_log err "eek, $OCF_RESKEY_dir already owned by $owner"
|
|
|
b8c11e |
return $OCF_ERR_GENERIC
|
|
|
b8c11e |
}
|
|
|
b8c11e |
@@ -180,6 +183,8 @@ sharedrsc_validate_all() {
|
|
|
b8c11e |
return $OCF_SUCCESS
|
|
|
b8c11e |
}
|
|
|
b8c11e |
|
|
|
b8c11e |
+# shellcheck disable=SC2034
|
|
|
b8c11e |
+# (OCF_REQUIRED_PARAMS consumed by ocf_rarun)
|
|
|
b8c11e |
OCF_REQUIRED_PARAMS="dir"
|
|
|
b8c11e |
ocf_rarun $*
|
|
|
b8c11e |
|
|
|
b8c11e |
diff --git a/script/service-runnable.in b/script/service-runnable.in
|
|
|
b8c11e |
index 9ea33d4..2f58641 100755
|
|
|
b8c11e |
--- a/script/service-runnable.in
|
|
|
b8c11e |
+++ b/script/service-runnable.in
|
|
|
b8c11e |
@@ -30,7 +30,7 @@ fi
|
|
|
b8c11e |
|
|
|
b8c11e |
if echo "$status" |
|
|
|
b8c11e |
sed -n '/^Revised cluster status:/,$p' |
|
|
|
b8c11e |
- egrep "^[[:space:]]+$service[[:space:]]+\(.*\):[[:space:]]+Started ([^[:space:]]+) *$" >/dev/null
|
|
|
b8c11e |
+ egrep "^[[:space:]]+${service}[[:space:]]+\(.*\):[[:space:]]+Started ([^[:space:]]+) *$" >/dev/null
|
|
|
b8c11e |
then
|
|
|
b8c11e |
# can be started - we're done.
|
|
|
b8c11e |
exit 0
|
|
|
b8c11e |
--
|
|
|
b8c11e |
2.18.0.rc2
|
|
|
b8c11e |
|