Merge pull request #700 from thriqon/shellcheck-party-SC2034
Remove unused variables (SC2034)
This commit is contained in:
		
				commit
				
					
						f0fb5215e8
					
				
			
		
					 24 changed files with 6 additions and 84 deletions
				
			
		| 
						 | 
					@ -18,8 +18,6 @@
 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
name="$__object_id"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
__package software-properties-common
 | 
					__package software-properties-common
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require="__package/software-properties-common" \
 | 
					require="__package/software-properties-common" \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,8 +18,6 @@
 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					# 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")
 | 
					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")
 | 
					suffix=$(cat "$__object/parameter/suffix" 2>/dev/null || echo "#/cdist:__block/$__object_id")
 | 
				
			||||||
text=$(cat "$__object/parameter/text")
 | 
					text=$(cat "$__object/parameter/text")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,6 @@ set_mode() {
 | 
				
			||||||
   echo chmod $1 >> "$__messages_out"
 | 
					   echo chmod $1 >> "$__messages_out"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_attributes=
 | 
					 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    present|exists)
 | 
					    present|exists)
 | 
				
			||||||
    # Note: Mode - needs to happen last as a chown/chgrp can alter mode by
 | 
					    # Note: Mode - needs to happen last as a chown/chgrp can alter mode by
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,6 @@ set_mode() {
 | 
				
			||||||
   echo chmod $1 >> "$__messages_out"
 | 
					   echo chmod $1 >> "$__messages_out"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_attributes=
 | 
					 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    present|exists|pre-exists)
 | 
					    present|exists|pre-exists)
 | 
				
			||||||
    # Note: Mode - needs to happen last as a chown/chgrp can alter mode by
 | 
					    # Note: Mode - needs to happen last as a chown/chgrp can alter mode by
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,6 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
name="$__object_id"
 | 
					 | 
				
			||||||
state_should="$(cat "$__object/parameter/state")"
 | 
					state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
state_is="$(cat "$__object/explorer/rule")"
 | 
					state_is="$(cat "$__object/explorer/rule")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,11 +40,9 @@ shorten_property() {
 | 
				
			||||||
if [ "$state" = "present" ]; then
 | 
					if [ "$state" = "present" ]; then
 | 
				
			||||||
   case "$os" in
 | 
					   case "$os" in
 | 
				
			||||||
      freebsd)
 | 
					      freebsd)
 | 
				
			||||||
         supported_add_properties="gid"
 | 
					 | 
				
			||||||
         supported_change_properties="gid"
 | 
					         supported_change_properties="gid"
 | 
				
			||||||
      ;;
 | 
					      ;;
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
         supported_add_properties="gid password system"
 | 
					 | 
				
			||||||
         supported_change_properties="gid password"
 | 
					         supported_change_properties="gid password"
 | 
				
			||||||
      ;;
 | 
					      ;;
 | 
				
			||||||
   esac
 | 
					   esac
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
					for object in $(find "$__global/object/__install_mount" -type d -name "$__cdist_object_marker"); do
 | 
				
			||||||
   device="$(cat "$object/parameter/device")"
 | 
					   device="$(cat "$object/parameter/device")"
 | 
				
			||||||
   dir="$(cat "$object/parameter/dir")"
 | 
					   dir="$(cat "$object/parameter/dir")"
 | 
				
			||||||
   prefix="$(cat "$object/parameter/prefix")"
 | 
					 | 
				
			||||||
   type="$(cat "$object/parameter/type")"
 | 
					   type="$(cat "$object/parameter/type")"
 | 
				
			||||||
   if [ -f "$object/parameter/options" ]; then
 | 
					   if [ -f "$object/parameter/options" ]; then
 | 
				
			||||||
      options="$(cat "$object/parameter/options")"
 | 
					      options="$(cat "$object/parameter/options")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,13 +19,7 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# set defaults
 | 
					# set defaults
 | 
				
			||||||
if [ -f "$__object/parameter/device" ]; then
 | 
					if [ ! -f "$__object/parameter/device" ]; then
 | 
				
			||||||
   device="(cat "$__object/parameter/device")"
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
   device="/$__object_id"
 | 
					   device="/$__object_id"
 | 
				
			||||||
   echo "$device" > "$__object/parameter/device"
 | 
					   echo "$device" > "$__object/parameter/device"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					 | 
				
			||||||
type="(cat "$__object/parameter/type")"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
options="(cat "$__object/parameter/options")"
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,8 +18,6 @@
 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
options="$(cat "$__object/parameter/options")"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#echo "reboot $options"
 | 
					#echo "reboot $options"
 | 
				
			||||||
cat << DONE
 | 
					cat << DONE
 | 
				
			||||||
echo 1 > /proc/sys/kernel/sysrq
 | 
					echo 1 > /proc/sys/kernel/sysrq
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,8 +18,7 @@ None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
options
 | 
					None
 | 
				
			||||||
   options to pass to the reboot command. e.g. -f
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,23 +0,0 @@
 | 
				
			||||||
#!/bin/sh -e
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# This file is part of cdist.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# cdist is free software: you can redistribute it and/or modify
 | 
					 | 
				
			||||||
# it under the terms of the GNU General Public License as published by
 | 
					 | 
				
			||||||
# the Free Software Foundation, either version 3 of the License, or
 | 
					 | 
				
			||||||
# (at your option) any later version.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# cdist is distributed in the hope that it will be useful,
 | 
					 | 
				
			||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					 | 
				
			||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
					 | 
				
			||||||
# GNU General Public License for more details.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# You should have received a copy of the GNU General Public License
 | 
					 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# set defaults
 | 
					 | 
				
			||||||
options="$(cat "$__object/parameter/options" 2>/dev/null \
 | 
					 | 
				
			||||||
   || echo "" | tee "$__object/parameter/options")"
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,23 +0,0 @@
 | 
				
			||||||
#!/bin/sh -e
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# This file is part of cdist.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# cdist is free software: you can redistribute it and/or modify
 | 
					 | 
				
			||||||
# it under the terms of the GNU General Public License as published by
 | 
					 | 
				
			||||||
# the Free Software Foundation, either version 3 of the License, or
 | 
					 | 
				
			||||||
# (at your option) any later version.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# cdist is distributed in the hope that it will be useful,
 | 
					 | 
				
			||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					 | 
				
			||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
					 | 
				
			||||||
# GNU General Public License for more details.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# You should have received a copy of the GNU General Public License
 | 
					 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# set defaults
 | 
					 | 
				
			||||||
target="$(cat "$__object/parameter/target" 2>/dev/null \
 | 
					 | 
				
			||||||
   || echo "/target" | tee "$__object/parameter/target")"
 | 
					 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					/target
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_umount/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_umount/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					target
 | 
				
			||||||
| 
						 | 
					@ -88,7 +88,7 @@ if [ $(expr "${ip}" : ".*, .*") -gt "0" ]; then
 | 
				
			||||||
   IFS=", "
 | 
					   IFS=", "
 | 
				
			||||||
   for cur_ip in ${ip}; do
 | 
					   for cur_ip in ${ip}; do
 | 
				
			||||||
      # Just get the last IP address for SSH to listen on
 | 
					      # 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
 | 
					      mgmt_ip=$(echo "${cur_ip}" | cut '-d ' -f1)   # In case using "ip netmask" format rather than CIDR
 | 
				
			||||||
   done
 | 
					   done
 | 
				
			||||||
   IFS="$SAVE_IFS"
 | 
					   IFS="$SAVE_IFS"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,7 +93,7 @@ if [ $(expr "${ip}" : ".*|.*") -gt "0" ]; then
 | 
				
			||||||
   IFS=", "
 | 
					   IFS=", "
 | 
				
			||||||
   for cur_ip in ${ip}; do
 | 
					   for cur_ip in ${ip}; do
 | 
				
			||||||
      # Just get the last IP address for SSH to listen on
 | 
					      # Just get the last IP address for SSH to listen on
 | 
				
			||||||
      mgmt_ip=$(echo "${ip}" | sed -E -e 's/^.*\|(.*)\/[0-9]+$/\1/')
 | 
					      mgmt_ip=$(echo "${cur_ip}" | sed -E -e 's/^.*\|(.*)\/[0-9]+$/\1/')
 | 
				
			||||||
   done
 | 
					   done
 | 
				
			||||||
   IFS="$SAVE_IFS"
 | 
					   IFS="$SAVE_IFS"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,8 +20,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
state=$(cat $__object/parameter/state 2>/dev/null)
 | 
					state=$(cat $__object/parameter/state 2>/dev/null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
path="/etc/"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ "${state}" = "present" ]; then
 | 
					if [ "${state}" = "present" ]; then
 | 
				
			||||||
    __file /etc/pacman.conf\
 | 
					    __file /etc/pacman.conf\
 | 
				
			||||||
        --owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist
 | 
					        --owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,6 @@ __postfix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Default to object_id
 | 
					# Default to object_id
 | 
				
			||||||
service="$(cat "$__object/parameter/service" 2>/dev/null || echo "$__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-*
 | 
					# NOTE: keep variables in sync in manifest,explorer,gencode-*
 | 
				
			||||||
prefix="#cdist:$__object_name"
 | 
					prefix="#cdist:$__object_name"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,6 @@
 | 
				
			||||||
# Default settings
 | 
					# Default settings
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
format="$(cat "$__object/parameter/format")"
 | 
					 | 
				
			||||||
state_should="$(cat "$__object/parameter/state")"
 | 
					state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
diskimage="/$__object_id"
 | 
					diskimage="/$__object_id"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,8 +20,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gem="$__object_id"
 | 
					gem="$__object_id"
 | 
				
			||||||
gemset="$(cat "$__object/parameter/gemset")"
 | 
					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")"
 | 
					state_is="$(cat "$__object/explorer/state")"
 | 
				
			||||||
user="$(cat "$__object/parameter/user")"
 | 
					user="$(cat "$__object/parameter/user")"
 | 
				
			||||||
state_should="$(cat "$__object/parameter/state")"
 | 
					state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,9 +18,6 @@
 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					# 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")"
 | 
					user="$(cat "$__object/parameter/user")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ ! -e "~$user/.rvm/scripts/rvm" ] ; then
 | 
					if [ ! -e "~$user/.rvm/scripts/rvm" ] ; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,6 @@
 | 
				
			||||||
ruby="$__object_id"
 | 
					ruby="$__object_id"
 | 
				
			||||||
state_is="$(cat "$__object/explorer/state")"
 | 
					state_is="$(cat "$__object/explorer/state")"
 | 
				
			||||||
user="$(cat "$__object/parameter/user")"
 | 
					user="$(cat "$__object/parameter/user")"
 | 
				
			||||||
default="$(cat "$__object/parameter/default" 2>/dev/null || true)"
 | 
					 | 
				
			||||||
state_should="$(cat "$__object/parameter/state")"
 | 
					state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[ "$state_is" = "$state_should" ] && exit 0
 | 
					[ "$state_is" = "$state_should" ] && exit 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
destination="$__object_id"
 | 
					destination="$__object_id"
 | 
				
			||||||
source="$(cat "$__object/parameter/source")"
 | 
					source="$(cat "$__object/parameter/source")"
 | 
				
			||||||
cksum="$(cat "$__object/parameter/cksum")"
 | 
					 | 
				
			||||||
stage_dir="$(cat "$__object/parameter/stage-dir")"
 | 
					stage_dir="$(cat "$__object/parameter/stage-dir")"
 | 
				
			||||||
state="$(cat "$__object/parameter/state")"
 | 
					state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
fetch_command="$(cat "$__object/parameter/fetch-command")"
 | 
					fetch_command="$(cat "$__object/parameter/fetch-command")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,11 +19,7 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
destination="$__object_id"
 | 
					destination="$__object_id"
 | 
				
			||||||
source="$(cat "$__object/parameter/source")"
 | 
					 | 
				
			||||||
cksum="$(cat "$__object/parameter/cksum")"
 | 
					 | 
				
			||||||
stage_dir="$(cat "$__object/parameter/stage-dir")"
 | 
					stage_dir="$(cat "$__object/parameter/stage-dir")"
 | 
				
			||||||
state="$(cat "$__object/parameter/state")"
 | 
					 | 
				
			||||||
fetch_command="$(cat "$__object/parameter/fetch-command")"
 | 
					 | 
				
			||||||
stage_file="${stage_dir}/${destination}"
 | 
					stage_file="${stage_dir}/${destination}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -- "/${destination}"
 | 
					set -- "/${destination}"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue