Browse Source

Fix errors reported by shellcheck for Puppet

Change-Id: I8277c6265501c74d07493f723472fbf4b85ca29e
changes/96/350496/5
Sergey Kraynev 2 years ago
parent
commit
cff7080d2e

+ 2
- 2
murano-apps/Puppet/package/Resources/scripts/core/exec_puppet_inline.sh View File

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

+ 1
- 1
murano-apps/Puppet/package/Resources/scripts/core/get_hiera_data.sh View File

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

+ 1
- 1
murano-apps/Puppet/package/Resources/scripts/core/install_puppet_module.sh View File

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

+ 13
- 12
murano-apps/Puppet/package/Resources/scripts/install/install_puppet.sh View File

@@ -39,7 +39,7 @@ function is_ubuntu {
39 39
 
40 40
 function is_opensuse {
41 41
     [ -f /usr/bin/zypper ] && \
42
-        cat /etc/os-release | grep -q -e "openSUSE"
42
+        grep -q -e "openSUSE" < /etc/os-release
43 43
 }
44 44
 
45 45
 # dnf is a drop-in replacement for yum on Fedora>=22
@@ -145,17 +145,17 @@ function setup_puppet_ubuntu {
145 145
             --assume-yes install -y --force-yes lsb-release
146 146
     fi
147 147
 
148
-    lsbdistcodename=`lsb_release -c -s`
149
-    if [ $lsbdistcodename != 'trusty' ] ; then
148
+    lsbdistcodename=$(lsb_release -c -s)
149
+    if [ "$lsbdistcodename" != 'trusty' ] ; then
150 150
         rubypkg=rubygems
151 151
     else
152 152
         rubypkg=ruby
153 153
     fi
154 154
 
155 155
 
156
-    PUPPET_VERSION=3.*
157
-    PUPPETDB_VERSION=2.*
158
-    FACTER_VERSION=2.*
156
+    PUPPET_VERSION="3.*"
157
+    PUPPETDB_VERSION="2.*"
158
+    FACTER_VERSION="2.*"
159 159
 
160 160
     cat > /etc/apt/preferences.d/00-puppet.pref <<EOF
161 161
 Package: puppet puppet-common puppetmaster puppetmaster-common puppetmaster-passenger
@@ -172,9 +172,9 @@ Pin-Priority: 501
172 172
 EOF
173 173
 
174 174
     puppet_deb=puppetlabs-release-${lsbdistcodename}.deb
175
-    wget http://apt.puppetlabs.com/$puppet_deb -O $puppet_deb
176
-    dpkg -i $puppet_deb
177
-    rm $puppet_deb
175
+    wget "http://apt.puppetlabs.com/$puppet_deb" -O "$puppet_deb"
176
+    dpkg -i "$puppet_deb"
177
+    rm "$puppet_deb"
178 178
 
179 179
     apt-get update
180 180
     DEBIAN_FRONTEND=noninteractive apt-get --option 'Dpkg::Options::=--force-confold' \
@@ -186,8 +186,9 @@ EOF
186 186
 }
187 187
 
188 188
 function setup_puppet_opensuse {
189
-    local version=`grep -e "VERSION_ID" /etc/os-release | tr -d "\"" | cut -d "=" -f2`
190
-    zypper ar http://download.opensuse.org/repositories/systemsmanagement:/puppet/openSUSE_${version}/systemsmanagement:puppet.repo
189
+    local version=
190
+    version=$(grep -e "VERSION_ID" /etc/os-release | tr -d "\"" | cut -d "=" -f2)
191
+    zypper ar "http://download.opensuse.org/repositories/systemsmanagement:/puppet/openSUSE_${version}/systemsmanagement:puppet.repo"
191 192
     zypper -v --gpg-auto-import-keys --no-gpg-checks -n ref
192 193
     zypper --non-interactive in --force-resolution puppet
193 194
     # Wipe out templatedir so we don't get warnings about it
@@ -259,4 +260,4 @@ else
259 260
     exit 1
260 261
 fi
261 262
 
262
-exit
263
+exit

+ 2
- 2
murano-apps/Puppet/package/Resources/scripts/server/install_dependencies.sh View File

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

Loading…
Cancel
Save