Merge pull request #705 from thriqon/shellcheck-party-various
Fix various shellcheck issues (SC2215, SC2059, SC2155, SC2091)
This commit is contained in:
commit
68b6477fe3
7 changed files with 15 additions and 11 deletions
|
@ -84,7 +84,7 @@ DONE
|
|||
if [ "$upload_file" ]; then
|
||||
echo upload >> "$__messages_out"
|
||||
# IPv6 fix
|
||||
if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$')
|
||||
if echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
|
||||
then
|
||||
my_target_host="[${__target_host}]"
|
||||
else
|
||||
|
|
|
@ -44,7 +44,7 @@ basepresent="$(cat "$__object/explorer/basepresent")"
|
|||
if [ "$state" = "present" ]; then
|
||||
if [ "$basepresent" = "NONE" ]; then
|
||||
# IPv6 fix
|
||||
if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$')
|
||||
if echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
|
||||
then
|
||||
my_target_host="[${__target_host}]"
|
||||
else
|
||||
|
|
|
@ -40,7 +40,7 @@ basepresent="$(cat "$__object/explorer/basepresent")"
|
|||
if [ "$state" = "present" ]; then
|
||||
if [ "$basepresent" = "NONE" ]; then
|
||||
# IPv6 fix
|
||||
if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$')
|
||||
if echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
|
||||
then
|
||||
my_target_host="[${__target_host}]"
|
||||
else
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
export key="$(cat "$__object/parameter/key" 2>/dev/null \
|
||||
key="$(cat "$__object/parameter/key" 2>/dev/null \
|
||||
|| echo "$__object_id")"
|
||||
export state="$(cat "$__object/parameter/state")"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
file="$(cat "$__object/parameter/file")"
|
||||
|
||||
|
@ -30,14 +30,15 @@ if [ ! -f "$file" ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
export delimiter="$(cat "$__object/parameter/delimiter")"
|
||||
export value="$(cat "$__object/parameter/value" 2>/dev/null \
|
||||
delimiter="$(cat "$__object/parameter/delimiter")"
|
||||
value="$(cat "$__object/parameter/value" 2>/dev/null \
|
||||
|| echo "__CDIST_NOTSET__")"
|
||||
if [ -f "$__object/parameter/exact_delimiter" ]; then
|
||||
export exact_delimiter=1
|
||||
exact_delimiter=1
|
||||
else
|
||||
export exact_delimiter=0
|
||||
exact_delimiter=0
|
||||
fi
|
||||
export key state delimiter value exact_delimiter
|
||||
|
||||
awk -f - "$file" <<"AWK_EOF"
|
||||
BEGIN {
|
||||
|
|
|
@ -33,7 +33,7 @@ case "$state_should" in
|
|||
cat << DONE
|
||||
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create"
|
||||
DONE
|
||||
if -f "$__object/parameter/default"; then
|
||||
if [ -f "$__object/parameter/default" ]; then
|
||||
cat << DONE
|
||||
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset"
|
||||
DONE
|
||||
|
|
|
@ -56,6 +56,7 @@ get_file() {
|
|||
}
|
||||
|
||||
fetch_file() {
|
||||
# shellcheck disable=SC2059
|
||||
printf "$fetch_command" "$source"
|
||||
printf ' > "%s"\n' "$stage_file"
|
||||
}
|
||||
|
@ -63,8 +64,10 @@ fetch_file() {
|
|||
fetch_and_prepare_file() {
|
||||
printf 'tmpdir="$(mktemp -d --tmpdir="/tmp" "%s")"\n' "${__type##*/}.XXXXXXXXXX"
|
||||
printf 'cd "$tmpdir"\n'
|
||||
# shellcheck disable=SC2059
|
||||
printf "$fetch_command > \"%s\"\n" "$source" "$source_file_name"
|
||||
prepare_command="$(cat "$__object/parameter/prepare-command")"
|
||||
# shellcheck disable=SC2059
|
||||
printf "$prepare_command > \"%s\"\n" "$source_file_name" "$stage_file"
|
||||
printf 'cd - >/dev/null\n'
|
||||
printf 'rm -rf "$tmpdir"\n'
|
||||
|
|
|
@ -60,7 +60,7 @@ if [ "$state" = "present" ]; then
|
|||
|
||||
case "$property" in
|
||||
gid)
|
||||
if $(echo "$new_value" | grep -q '^[0-9][0-9]*$'); then
|
||||
if echo "$new_value" | grep -q '^[0-9][0-9]*$'; then
|
||||
field=4
|
||||
else
|
||||
# We were passed a group name. Compare the gid in
|
||||
|
|
Loading…
Reference in a new issue