]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits: mon: auth_caps: variables must be local
authorJoao Eduardo Luis <joao@redhat.com>
Tue, 30 Sep 2014 17:49:19 +0000 (18:49 +0100)
committerJoao Eduardo Luis <joao@redhat.com>
Fri, 3 Oct 2014 15:24:19 +0000 (16:24 +0100)
We have variables with the same name that are being shared!  We don't
hit any issues with it currently because the code just kind of works
even though that happens.  Add a bit of new logic that relies on an
immutable return code (for instance) and we're in the woods.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
qa/workunits/mon/auth_caps.sh

index f150abdd8172addc03c8f366850e0a304ced2034..43d5747ce2df6d4d90cf49f3e692dcc627d627e0 100755 (executable)
@@ -24,7 +24,10 @@ trap "rm $tmp" INT ERR EXIT QUIT 0
 expect() {
 
   set +e
-  expected_ret=$1
+
+  local expected_ret=$1
+  local ret
+
   shift
   cmd=$@
 
@@ -42,10 +45,11 @@ expect() {
 }
 
 read_ops() {
+  local caps=$1
+  local has_read=1 has_exec=1
+  local ret
+  local args
 
-  caps=$1
-  has_read=1
-  has_exec=1
   ( echo $caps | grep 'r' ) || has_read=0
   ( echo $caps | grep 'x' ) || has_exec=0
   
@@ -72,10 +76,11 @@ read_ops() {
 
 write_ops() {
 
-  caps=$1
-  has_read=1
-  has_write=1
-  has_exec=1
+  local caps=$1
+  local has_read=1 has_write=1 has_exec=1
+  local ret
+  local args
+
   ( echo $caps | grep 'r' ) || has_read=0
   ( echo $caps | grep 'w' ) || has_write=0
   ( echo $caps | grep 'x' ) || has_exec=0