Remove unused variables (almost, found bugs?)

Solves SC2034

references #540.
This commit is contained in:
Jonas Weber 2018-10-03 21:11:59 +02:00
parent ef8ec8641e
commit 6b0f8fba22
21 changed files with 11 additions and 38 deletions

View file

@ -18,8 +18,6 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
name="$__object_id"
__package software-properties-common
require="__package/software-properties-common" \

View file

@ -18,8 +18,6 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
file="$(cat "$__object/parameter/file" 2>/dev/null || echo "/$__object_id")"
prefix=$(cat "$__object/parameter/prefix" 2>/dev/null || echo "#cdist:__block/$__object_id")
suffix=$(cat "$__object/parameter/suffix" 2>/dev/null || echo "#/cdist:__block/$__object_id")
text=$(cat "$__object/parameter/text")

View file

@ -56,7 +56,6 @@ set_mode() {
echo chmod $1 >> "$__messages_out"
}
set_attributes=
case "$state_should" in
present|exists)
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by

View file

@ -57,7 +57,6 @@ set_mode() {
echo chmod $1 >> "$__messages_out"
}
set_attributes=
case "$state_should" in
present|exists|pre-exists)
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by

View file

@ -19,7 +19,6 @@
#
#
name="$__object_id"
state_should="$(cat "$__object/parameter/state")"
state_is="$(cat "$__object/explorer/rule")"

View file

@ -40,11 +40,9 @@ shorten_property() {
if [ "$state" = "present" ]; then
case "$os" in
freebsd)
supported_add_properties="gid"
supported_change_properties="gid"
;;
*)
supported_add_properties="gid password system"
supported_change_properties="gid password"
;;
esac

View file

@ -28,7 +28,6 @@ $__remote_exec $__target_host blkid > "$__object/files/blkid"
for object in $(find "$__global/object/__install_mount" -type d -name "$__cdist_object_marker"); do
device="$(cat "$object/parameter/device")"
dir="$(cat "$object/parameter/dir")"
prefix="$(cat "$object/parameter/prefix")"
type="$(cat "$object/parameter/type")"
if [ -f "$object/parameter/options" ]; then
options="$(cat "$object/parameter/options")"

View file

@ -19,13 +19,7 @@
#
# set defaults
if [ -f "$__object/parameter/device" ]; then
device="(cat "$__object/parameter/device")"
else
if [ ! -f "$__object/parameter/device" ]; then
device="/$__object_id"
echo "$device" > "$__object/parameter/device"
fi
type="(cat "$__object/parameter/type")"
options="(cat "$__object/parameter/options")"

View file

@ -18,8 +18,6 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
options="$(cat "$__object/parameter/options")"
#echo "reboot $options"
cat << DONE
echo 1 > /proc/sys/kernel/sysrq

View file

@ -19,5 +19,7 @@
#
# set defaults
options="$(cat "$__object/parameter/options" 2>/dev/null \
|| echo "" | tee "$__object/parameter/options")"
# TODO is this neccesary or should this be handled using the usual parameter/default workflow?
if [ ! -f "$__object/parameter/options" ]; then
touch "$__object/parameter/options"
fi

View file

@ -19,5 +19,7 @@
#
# set defaults
target="$(cat "$__object/parameter/target" 2>/dev/null \
|| echo "/target" | tee "$__object/parameter/target")"
# TODO is this neccesary or should this be handled using the usual parameter/default workflow?
if [ ! -f "$__object/parameter/target" ]; then
echo "/target" > "$__object/parameter/target"
fi

View file

@ -87,6 +87,7 @@ if [ $(expr "${ip}" : ".*, .*") -gt "0" ]; then
SAVE_IFS="$IFS"
IFS=", "
for cur_ip in ${ip}; do
# TODO BUG? Why is cur_ip unused in the following line?
# Just get the last IP address for SSH to listen on
mgmt_ip=$(echo "${ip}" | cut '-d ' -f1) # In case using "ip netmask" format rather than CIDR
done

View file

@ -92,6 +92,7 @@ if [ $(expr "${ip}" : ".*|.*") -gt "0" ]; then
SAVE_IFS="$IFS"
IFS=", "
for cur_ip in ${ip}; do
# TODO BUG? Why is cur_ip unused in the following line?
# Just get the last IP address for SSH to listen on
mgmt_ip=$(echo "${ip}" | sed -E -e 's/^.*\|(.*)\/[0-9]+$/\1/')
done

View file

@ -20,8 +20,6 @@
state=$(cat $__object/parameter/state 2>/dev/null)
path="/etc/"
if [ "${state}" = "present" ]; then
__file /etc/pacman.conf\
--owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist

View file

@ -36,7 +36,6 @@ __postfix
# Default to object_id
service="$(cat "$__object/parameter/service" 2>/dev/null || echo "$__object_id")"
state="$(cat "$__object/parameter/state")"
# NOTE: keep variables in sync in manifest,explorer,gencode-*
prefix="#cdist:$__object_name"

View file

@ -4,7 +4,6 @@
# Default settings
#
format="$(cat "$__object/parameter/format")"
state_should="$(cat "$__object/parameter/state")"
diskimage="/$__object_id"

View file

@ -20,8 +20,6 @@
gem="$__object_id"
gemset="$(cat "$__object/parameter/gemset")"
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
gemsetname="$(echo "$gemset" | cut -d '@' -f 2)"
state_is="$(cat "$__object/explorer/state")"
user="$(cat "$__object/parameter/user")"
state_should="$(cat "$__object/parameter/state")"

View file

@ -18,9 +18,6 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
gemset="$__object_id"
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
user="$(cat "$__object/parameter/user")"
if [ ! -e "~$user/.rvm/scripts/rvm" ] ; then

View file

@ -21,7 +21,6 @@
ruby="$__object_id"
state_is="$(cat "$__object/explorer/state")"
user="$(cat "$__object/parameter/user")"
default="$(cat "$__object/parameter/default" 2>/dev/null || true)"
state_should="$(cat "$__object/parameter/state")"
[ "$state_is" = "$state_should" ] && exit 0

View file

@ -23,7 +23,6 @@
destination="$__object_id"
source="$(cat "$__object/parameter/source")"
cksum="$(cat "$__object/parameter/cksum")"
stage_dir="$(cat "$__object/parameter/stage-dir")"
state="$(cat "$__object/parameter/state")"
fetch_command="$(cat "$__object/parameter/fetch-command")"

View file

@ -19,11 +19,7 @@
#
destination="$__object_id"
source="$(cat "$__object/parameter/source")"
cksum="$(cat "$__object/parameter/cksum")"
stage_dir="$(cat "$__object/parameter/stage-dir")"
state="$(cat "$__object/parameter/state")"
fetch_command="$(cat "$__object/parameter/fetch-command")"
stage_file="${stage_dir}/${destination}"
set -- "/${destination}"