Fix errors reported by shellcheck for Puppet

Change-Id: I8277c6265501c74d07493f723472fbf4b85ca29e
This commit is contained in:
Sergey Kraynev 2016-08-03 12:59:16 +03:00 committed by Alexey Khivin
parent 95d03fed86
commit cff7080d2e
5 changed files with 19 additions and 18 deletions

View File

@ -2,7 +2,7 @@
set +e
PUPPET_CODE=`echo -n $1 | base64 -d`
PUPPET_CODE=$(echo -n "$1" | base64 -d)
puppet apply --detailed-exitcodes --color=false --execute "${PUPPET_CODE}"
@ -11,4 +11,4 @@ if [ "${PUPPET_RETURN}" -eq 4 ] || [ "${PUPPET_RETURN}" -eq 6 ] ; then
exit ${PUPPET_RETURN}
fi
set -e
set -e

View File

@ -2,4 +2,4 @@
KEY="$1"
hiera -c /etc/puppet/hiera.yaml $KEY
hiera -c /etc/puppet/hiera.yaml "$KEY"

View File

@ -2,6 +2,6 @@
module_name=$1
sudo puppet module install ${module_name}
sudo puppet module install "${module_name}"
exit

View File

@ -39,7 +39,7 @@ function is_ubuntu {
function is_opensuse {
[ -f /usr/bin/zypper ] && \
cat /etc/os-release | grep -q -e "openSUSE"
grep -q -e "openSUSE" < /etc/os-release
}
# dnf is a drop-in replacement for yum on Fedora>=22
@ -145,17 +145,17 @@ function setup_puppet_ubuntu {
--assume-yes install -y --force-yes lsb-release
fi
lsbdistcodename=`lsb_release -c -s`
if [ $lsbdistcodename != 'trusty' ] ; then
lsbdistcodename=$(lsb_release -c -s)
if [ "$lsbdistcodename" != 'trusty' ] ; then
rubypkg=rubygems
else
rubypkg=ruby
fi
PUPPET_VERSION=3.*
PUPPETDB_VERSION=2.*
FACTER_VERSION=2.*
PUPPET_VERSION="3.*"
PUPPETDB_VERSION="2.*"
FACTER_VERSION="2.*"
cat > /etc/apt/preferences.d/00-puppet.pref <<EOF
Package: puppet puppet-common puppetmaster puppetmaster-common puppetmaster-passenger
@ -172,9 +172,9 @@ Pin-Priority: 501
EOF
puppet_deb=puppetlabs-release-${lsbdistcodename}.deb
wget http://apt.puppetlabs.com/$puppet_deb -O $puppet_deb
dpkg -i $puppet_deb
rm $puppet_deb
wget "http://apt.puppetlabs.com/$puppet_deb" -O "$puppet_deb"
dpkg -i "$puppet_deb"
rm "$puppet_deb"
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get --option 'Dpkg::Options::=--force-confold' \
@ -186,8 +186,9 @@ EOF
}
function setup_puppet_opensuse {
local version=`grep -e "VERSION_ID" /etc/os-release | tr -d "\"" | cut -d "=" -f2`
zypper ar http://download.opensuse.org/repositories/systemsmanagement:/puppet/openSUSE_${version}/systemsmanagement:puppet.repo
local version=
version=$(grep -e "VERSION_ID" /etc/os-release | tr -d "\"" | cut -d "=" -f2)
zypper ar "http://download.opensuse.org/repositories/systemsmanagement:/puppet/openSUSE_${version}/systemsmanagement:puppet.repo"
zypper -v --gpg-auto-import-keys --no-gpg-checks -n ref
zypper --non-interactive in --force-resolution puppet
# Wipe out templatedir so we don't get warnings about it
@ -259,4 +260,4 @@ else
exit 1
fi
exit
exit

View File

@ -5,7 +5,7 @@ ENV_NAME="$1"
PUPPETFILE_LINK="$2"
ENV_DIR="/etc/puppet/environments/${ENV_NAME}"
cd ${ENV_DIR}
wget --quiet -c ${PUPPETFILE_LINK} -O Puppetfile
cd "${ENV_DIR}"
wget --quiet -c "${PUPPETFILE_LINK}" -O Puppetfile
librarian-puppet install