clean-ups in the file

- replace tabs with 4 spaces
- removed trailing spaces
- fixed indenting
- made if; then look the same
This commit is contained in:
Remi Bergsma 2015-08-11 14:55:16 +02:00
parent ee9b644e28
commit 2f858a7d08

View File

@ -8,9 +8,9 @@
# to you under the Apache License, Version 2.0 (the # to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance # "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at # with the License. You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, # Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an # software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@ -45,40 +45,41 @@ jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.2.jar'
while getopts 'm:h:f:u:Ft:e:s:o:r:d:p:'# OPTION while getopts 'm:h:f:u:Ft:e:s:o:r:d:p:'# OPTION
do do
case $OPTION in case $OPTION in
m) mflag=1 m) mflag=1
mntpoint="$OPTARG" mntpoint="$OPTARG"
;; ;;
f) fflag=1 f) fflag=1
tmpltimg="$OPTARG" tmpltimg="$OPTARG"
;; ;;
u) uflag=1 u) uflag=1
url="$OPTARG" url="$OPTARG"
;; ;;
F) Fflag=1 ;; F) Fflag=1
;;
t) templateId="$OPTARG" t) templateId="$OPTARG"
;; ;;
e) ext="$OPTARG" e) ext="$OPTARG"
;; ;;
h) hyper="$OPTARG" h) hyper="$OPTARG"
;; ;;
s) sflag=1 s) sflag=1
msKey="$OPTARG" msKey="$OPTARG"
;; ;;
o) oflag=1 o) oflag=1
dbHost="$OPTARG" dbHost="$OPTARG"
;; ;;
r) rflag=1 r) rflag=1
dbUser="$OPTARG" dbUser="$OPTARG"
;; ;;
d) dflag=1 d) dflag=1
dbPassword="$OPTARG" dbPassword="$OPTARG"
;; ;;
p) pflag=1 p) pflag=1
dbPort="$OPTARG" dbPort="$OPTARG"
;; ;;
?) usage ?) usage
failed 2 failed 2
;; ;;
esac esac
done done
@ -94,28 +95,32 @@ then
failed 2 failed 2
fi fi
if [ ! -d $mntpoint ] if [ ! -d $mntpoint ]
then then
echo "mount point $mntpoint doesn't exist\n" echo "mount point $mntpoint doesn't exist\n"
failed 4 failed 4
fi fi
if [[ "$fflag" == "1" && ! -f $tmpltimg ]] if [[ "$fflag" == "1" && ! -f $tmpltimg ]]
then then
echo "template image file $tmpltimg doesn't exist" echo "template image file $tmpltimg doesn't exist"
failed 3 failed 3
fi fi
if [ -f /etc/cloudstack/management/db.properties ]; then if [ -f /etc/cloudstack/management/db.properties ]
if [ "$pflag" != 1 ]; then then
if [ "$pflag" != 1 ]
then
dbPort=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.port' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') dbPort=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.port' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
fi fi
if [ "$oflag" != 1 ]; then if [ "$oflag" != 1 ]
then
dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
fi fi
if [ "$rflag" != 1 ]; then if [ "$rflag" != 1 ]
then
dbUser=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.username' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') dbUser=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.username' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
fi fi
@ -186,8 +191,8 @@ fi
if [ ! $templateId ] if [ ! $templateId ]
then then
echo "Unable to get template Id from database" echo "Unable to get template Id from database"
failed 8 failed 8
fi fi
_uuid=$(uuidgen) _uuid=$(uuidgen)