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 # force blank cap with '--force'
17 keymap
["blank"]=`ceph auth get-or-create-key client.blank mon 'allow' --force` ||
exit 1
18 keymap
["all"]=`ceph auth get-or-create-key client.all mon 'allow *'` ||
exit 1
21 ceph auth
export > $tmp
23 trap "rm $tmp" INT ERR EXIT QUIT
0
40 if [[ $ret -ne $expected_ret ]]; then
41 echo "ERROR: running \'$cmd\': expected $expected_ret got $ret"
50 local has_read
=1 has_exec
=1
54 ( echo $caps |
grep 'r' ) || has_read
=0
55 ( echo $caps |
grep 'x' ) || has_exec
=0
57 if [[ "$caps" == "all" ]]; then
63 if [[ $has_read -gt 0 && $has_exec -gt 0 ]]; then
67 args
="--id $caps --key ${keymap[$caps]}"
69 expect
$ret ceph auth get client.admin
$args
70 expect
$ret ceph auth get-key client.admin
$args
71 expect
$ret ceph auth
export $args
72 expect
$ret ceph auth
export client.admin
$args
73 expect
$ret ceph auth list
$args
74 expect
$ret ceph auth print-key client.admin
$args
75 expect
$ret ceph auth print_key client.admin
$args
81 local has_read
=1 has_write
=1 has_exec
=1
86 ( echo $caps |
grep 'r' ) || has_read
=0
87 ( echo $caps |
grep 'w' ) || has_write
=0
88 ( echo $caps |
grep 'x' ) || has_exec
=0
90 if [[ "$caps" == "all" ]]; then
97 if [[ $has_read -gt 0 && $has_write -gt 0 && $has_exec -gt 0 ]]; then
101 args
="--id $caps --key ${keymap[$caps]}"
103 expect
$ret ceph auth add client.foo
$args
104 expect
$ret "ceph auth caps client.foo mon 'allow *' $args"
105 expect
$ret ceph auth get-or-create client.admin
$args
106 echo "wtf -- before: err=$err ret=$ret"
108 [[ $ret -eq 0 ]] && err
=22 # EINVAL
109 expect
$err "ceph auth get-or-create client.bar mon 'allow' $args"
110 echo "wtf -- after: err=$err ret=$ret"
111 expect
$ret "ceph auth get-or-create client.bar mon 'allow' --force $args"
112 expect
$ret ceph auth get-or-create-key client.admin
$args
113 expect
$ret ceph auth get-or-create-key client.baz
$args
114 expect
$ret ceph auth del client.bar
$args
115 expect
$ret ceph auth del client.baz
$args
116 expect
$ret ceph auth del client.foo
$args
117 expect
$ret ceph auth import
-i $tmp $args
120 echo "running combinations: ${!keymap[@]}"
124 for i
in ${!keymap[@]}; do
126 if [[ -z "$subcmd" ||
"$subcmd" == "read" ||
"$subcmd" == "all" ]]; then
130 if [[ -z "$subcmd" ||
"$subcmd" == "write" ||
"$subcmd" == "all" ]]; then
136 for i
in ${combinations} blank all
; do
137 ceph auth del client.
$i ||
exit 1