]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/bash |
2 | ||
3 | tmp=/tmp/cephtest-mon-caps-madness | |
4 | ||
5 | exit_on_error=1 | |
6 | ||
7 | [[ ! -z $TEST_EXIT_ON_ERROR ]] && exit_on_error=$TEST_EXIT_ON_ERROR | |
8 | ||
9 | expect() | |
10 | { | |
11 | cmd=$1 | |
12 | expected_ret=$2 | |
13 | ||
14 | echo $cmd | |
15 | eval $cmd >&/dev/null | |
16 | ret=$? | |
17 | ||
18 | if [[ $ret -ne $expected_ret ]]; then | |
19 | echo "Error: Expected return $expected_ret, got $ret" | |
20 | [[ $exit_on_error -eq 1 ]] && exit 1 | |
21 | return 1 | |
22 | fi | |
23 | ||
24 | return 0 | |
25 | } | |
26 | ||
27 | expect "ceph auth get-or-create client.bazar > $tmp.bazar.keyring" 0 | |
28 | expect "ceph -k $tmp.bazar.keyring --user bazar mon_status" 13 | |
29 | ceph auth del client.bazar | |
30 | ||
c07f9fc5 | 31 | c="'allow command \"auth ls\", allow command mon_status'" |
7c673cae FG |
32 | expect "ceph auth get-or-create client.foo mon $c > $tmp.foo.keyring" 0 |
33 | expect "ceph -k $tmp.foo.keyring --user foo mon_status" 0 | |
c07f9fc5 | 34 | expect "ceph -k $tmp.foo.keyring --user foo auth ls" 0 |
7c673cae FG |
35 | expect "ceph -k $tmp.foo.keyring --user foo auth export" 13 |
36 | expect "ceph -k $tmp.foo.keyring --user foo auth del client.bazar" 13 | |
37 | expect "ceph -k $tmp.foo.keyring --user foo osd dump" 13 | |
38 | expect "ceph -k $tmp.foo.keyring --user foo pg dump" 13 | |
39 | expect "ceph -k $tmp.foo.keyring --user foo quorum_status" 13 | |
40 | ceph auth del client.foo | |
41 | ||
42 | c="'allow command service with prefix=list, allow command mon_status'" | |
43 | expect "ceph auth get-or-create client.bar mon $c > $tmp.bar.keyring" 0 | |
44 | expect "ceph -k $tmp.bar.keyring --user bar mon_status" 0 | |
c07f9fc5 | 45 | expect "ceph -k $tmp.bar.keyring --user bar auth ls" 13 |
7c673cae FG |
46 | expect "ceph -k $tmp.bar.keyring --user bar auth export" 13 |
47 | expect "ceph -k $tmp.bar.keyring --user bar auth del client.foo" 13 | |
48 | expect "ceph -k $tmp.bar.keyring --user bar osd dump" 13 | |
49 | expect "ceph -k $tmp.bar.keyring --user bar pg dump" 13 | |
50 | expect "ceph -k $tmp.bar.keyring --user bar quorum_status" 13 | |
51 | ceph auth del client.bar | |
52 | ||
53 | rm $tmp.bazar.keyring $tmp.foo.keyring $tmp.bar.keyring | |
54 | ||
c07f9fc5 | 55 | echo OK |