From a78baccc827ece35501888cf83dab62144dac1ea Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Sat, 6 Oct 2018 13:59:47 +0200 Subject: [PATCH] Fix SC2154. Note: ignoring __ vars. --- cdist/conf/type/__jail_freebsd10/gencode-remote | 4 ++-- cdist/conf/type/__jail_freebsd9/gencode-remote | 4 ++-- cdist/conf/type/__package_opkg/gencode-remote | 2 +- cdist/conf/type/__pf_ruleset/gencode-local | 4 ++-- cdist/conf/type/__postgres_extension/gencode-remote | 2 +- cdist/conf/type/__process/gencode-remote | 1 + cdist/conf/type/__zypper_service/gencode-remote | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cdist/conf/type/__jail_freebsd10/gencode-remote b/cdist/conf/type/__jail_freebsd10/gencode-remote index a5e097f9..73518326 100755 --- a/cdist/conf/type/__jail_freebsd10/gencode-remote +++ b/cdist/conf/type/__jail_freebsd10/gencode-remote @@ -120,13 +120,13 @@ deleteJail() { fi output="\$(mount | grep "\\/rw\\/${name}\\/")" || true if [ -n "\${output}" ]; then # >=1 rw mount is mounted still - for DIR in "${output}"; do + for DIR in "\${output}"; do umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print \$3}')" done fi output="\$(mount | grep "\\/${name} (")" || true if [ -n "\${output}" ]; then # ro mount is mounted still - umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print \$3}')" + umount -F "/etc/fstab.${name}" "\$(echo "\${output}" | awk '{print \$3}')" fi EOF # Remove the jail's rw mountpoints diff --git a/cdist/conf/type/__jail_freebsd9/gencode-remote b/cdist/conf/type/__jail_freebsd9/gencode-remote index 7f3828b2..be583e5d 100755 --- a/cdist/conf/type/__jail_freebsd9/gencode-remote +++ b/cdist/conf/type/__jail_freebsd9/gencode-remote @@ -125,13 +125,13 @@ deleteJail() { fi output="\$(mount | grep "\\/rw\\/${name}\\/")" || true if [ -n "\${output}" ]; then # >=1 rw mount is mounted still - for DIR in "${output}"; do + for DIR in "\${output}"; do umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print \$3}')" done fi output="\$(mount | grep "\\/${name} (")" || true if [ -n "\${output}" ]; then # ro mount is mounted still - umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print \$3}')" + umount -F "/etc/fstab.${name}" "\$(echo "\${output}" | awk '{print \$3}')" fi EOF # Remove the jail's rw mountpoints diff --git a/cdist/conf/type/__package_opkg/gencode-remote b/cdist/conf/type/__package_opkg/gencode-remote index 7013ec9f..e94ff388 100755 --- a/cdist/conf/type/__package_opkg/gencode-remote +++ b/cdist/conf/type/__package_opkg/gencode-remote @@ -51,7 +51,7 @@ case "$state_should" in echo "opkg --verbosity=0 remove '$name'" ;; *) - echo "Unknown state: $state" >&2 + echo "Unknown state: ${state_should}" >&2 exit 1 ;; esac diff --git a/cdist/conf/type/__pf_ruleset/gencode-local b/cdist/conf/type/__pf_ruleset/gencode-local index b9de1bce..11bfb0b1 100755 --- a/cdist/conf/type/__pf_ruleset/gencode-local +++ b/cdist/conf/type/__pf_ruleset/gencode-local @@ -69,10 +69,10 @@ fi if [ -n "${cksum}" ]; then if [ ! "\${currentSum}" = "${cksum}" ]; then - $__remote_copy "${source}" "${my_target_host}:${rcvar}.new" + $__remote_copy "${source}" "\${my_target_host}:${rcvar}.new" fi else # File just doesn't exist yet - $__remote_copy "${source}" "${my_target_host}:${rcvar}.new" + $__remote_copy "${source}" "\${my_target_host}:${rcvar}.new" fi EOF diff --git a/cdist/conf/type/__postgres_extension/gencode-remote b/cdist/conf/type/__postgres_extension/gencode-remote index f7895103..627067c7 100755 --- a/cdist/conf/type/__postgres_extension/gencode-remote +++ b/cdist/conf/type/__postgres_extension/gencode-remote @@ -33,7 +33,7 @@ case "$state_should" in echo "su - postgres -c 'psql -c \"$cmd\" \"$dbname\"'" ;; absent) - cmd="DROP EXTENSION IF EXISTS $extenstion" + cmd="DROP EXTENSION IF EXISTS $extension" echo "su - postgres -c 'psql -c \"$cmd\" \"$dbname\"'" ;; esac diff --git a/cdist/conf/type/__process/gencode-remote b/cdist/conf/type/__process/gencode-remote index fc491321..d14cf506 100755 --- a/cdist/conf/type/__process/gencode-remote +++ b/cdist/conf/type/__process/gencode-remote @@ -52,6 +52,7 @@ case "$state_should" in if [ -f "$__object/parameter/stop" ]; then cat "$__object/parameter/stop" else + # TODO: what should be runs variable? echo kill "${runs}" fi echo "stopped" >> "$__messages_out" diff --git a/cdist/conf/type/__zypper_service/gencode-remote b/cdist/conf/type/__zypper_service/gencode-remote index 59ffc942..4ccfe301 100755 --- a/cdist/conf/type/__zypper_service/gencode-remote +++ b/cdist/conf/type/__zypper_service/gencode-remote @@ -76,7 +76,7 @@ case "$state_should" in echo "zypper $zypper_def_opts ref" ;; absent) - echo "zypper $zypper_def_opts removeservice $service_id" + echo "zypper $zypper_def_opts removeservice $exp_id" echo "zypper $zypper_def_opts refs" echo "zypper $zypper_def_opts ref" ;;