Don't mix declaration and set of locals
Ia0957b47187c3dcadd46154b17022c4213781112 proposes to have bashate
find instances of setting a local value. The issue is that "local"
always returns 0, thus hiding any failure in the commands running to
set the variable.
This is an automated replacement of such instances
Depends-On: I676c805e8f0401f75cc5367eee83b3d880cdef81
Change-Id: I9c8912a8fd596535589b207d7fc553b9d951d3fe
diff --git a/functions b/functions
index ff95c89..8cf7a25 100644
--- a/functions
+++ b/functions
@@ -264,7 +264,8 @@
;;
*.img)
image_name=$(basename "$image" ".img")
- local format=$(qemu-img info ${image} | awk '/^file format/ { print $3; exit }')
+ local format
+ format=$(qemu-img info ${image} | awk '/^file format/ { print $3; exit }')
if [[ ",qcow2,raw,vdi,vmdk,vpc," =~ ",$format," ]]; then
disk_format=$format
else
@@ -405,7 +406,8 @@
local vm_id=$1
local network_name=$2
local nova_result="$(nova show $vm_id)"
- local ip=$(echo "$nova_result" | grep "$network_name" | get_field 2)
+ local ip
+ ip=$(echo "$nova_result" | grep "$network_name" | get_field 2)
if [[ $ip = "" ]];then
echo "$nova_result"
die $LINENO "[Fail] Coudn't get ipaddress of VM"
@@ -455,7 +457,8 @@
# homedir permissions on RHEL and common practice of making DEST in
# the stack user's homedir.
- local real_path=$(readlink -f $1)
+ local real_path
+ real_path=$(readlink -f $1)
local rebuilt_path=""
for i in $(echo ${real_path} | tr "/" " "); do
rebuilt_path=$rebuilt_path"/"$i