7 combinations
="r w x rw rx wx rwx"
9 for i
in ${combinations}; do
11 k
=`ceph auth get-or-create-key client.$i mon "allow $i"` ||
exit 1
16 keymap
["all"]=`ceph auth get-or-create-key client.all mon 'allow *'` ||
exit 1
19 ceph auth
export > $tmp
21 trap "rm $tmp" INT ERR EXIT QUIT
0
38 if [[ $ret -ne $expected_ret ]]; then
39 echo "ERROR: running \'$cmd\': expected $expected_ret got $ret"
48 local has_read
=1 has_exec
=1
52 ( echo $caps |
grep 'r' ) || has_read
=0
53 ( echo $caps |
grep 'x' ) || has_exec
=0
55 if [[ "$caps" == "all" ]]; then
61 if [[ $has_read -gt 0 && $has_exec -gt 0 ]]; then
65 args
="--id $caps --key ${keymap[$caps]}"
67 expect
$ret ceph auth get client.admin
$args
68 expect
$ret ceph auth get-key client.admin
$args
69 expect
$ret ceph auth
export $args
70 expect
$ret ceph auth
export client.admin
$args
71 expect
$ret ceph auth
ls $args
72 expect
$ret ceph auth print-key client.admin
$args
73 expect
$ret ceph auth print_key client.admin
$args
79 local has_read
=1 has_write
=1 has_exec
=1
83 ( echo $caps |
grep 'r' ) || has_read
=0
84 ( echo $caps |
grep 'w' ) || has_write
=0
85 ( echo $caps |
grep 'x' ) || has_exec
=0
87 if [[ "$caps" == "all" ]]; then
94 if [[ $has_read -gt 0 && $has_write -gt 0 && $has_exec -gt 0 ]]; then
98 args
="--id $caps --key ${keymap[$caps]}"
100 expect
$ret ceph auth add client.foo
$args
101 expect
$ret "ceph auth caps client.foo mon 'allow *' $args"
102 expect
$ret ceph auth get-or-create client.admin
$args
103 expect
$ret ceph auth get-or-create-key client.admin
$args
104 expect
$ret ceph auth get-or-create-key client.baz
$args
105 expect
$ret ceph auth del client.foo
$args
106 expect
$ret ceph auth del client.baz
$args
107 expect
$ret ceph auth import
-i $tmp $args
110 echo "running combinations: ${!keymap[@]}"
114 for i
in ${!keymap[@]}; do
116 if [[ -z "$subcmd" ||
"$subcmd" == "read" ||
"$subcmd" == "all" ]]; then
120 if [[ -z "$subcmd" ||
"$subcmd" == "write" ||
"$subcmd" == "all" ]]; then
126 for i
in ${combinations} all
; do
127 ceph auth del client.
$i ||
exit 1